P3K: fix DeprecationWarning under Python 3.x 

The warning is:

```
.../site-packages/IPython/utils/jsonutil.py:121: DeprecationWarning: encodestring() is a deprecated alias, use encodebytes()
  encoded['image/png'] = encodestring(pngdata).decode('ascii')
```