BUG : fix list comprehensions over class members

Due to scoping fixes in py3k, list comprehensions over class level
attributes during class definition does not work (see
http://stackoverflow.com/questions/13905741/accessing-class-variables-from-a-list-comprehension-in-the-class-definition).

Superficially Fixes #3436. There seem to be other issues
BUG : fix glaring syntax error
BUG : fix encoding of png data

When formatting the png data to send over the wire need to decode the
byte string to ascii.  If this is not done the literal string sent
to the browser is:
   "data:image/png;base64,b'iVBOR...'"
instead of
   "data:image/png;base64,iVBOR..."

The extra b' makes the string no longer a valid png which is why
we were getting white boxes
Merge pull request #3464 from tacaswell/nbagg_py3k

BUG : nbagg py3k compatibility