Change to encodestring to b64encode to avoid newlines in the data URI...
Change to encodestring to b64encode to avoid newlines in the data URI
The point of this is to improve compatibility with older browsers.
also, encodestring is depricated in python 3.