I am using qrcode library to generate a QR code. 
controller:
def create_qr():
    import qrcode
    text = "hello world test string"
    img = qrcode.make(text)  
    return locals()
view:
<img src="{{=img}}">
using the above code, img is being returned as a PIL Image object but the view is not displaying an image. 
how can I make the view display the generated PIL Image object? do i need to save the image somewhere first and if so, how?
thanks,
ben