def _insert_png(self, cursor, png):
        """ Insert raw PNG data into the widget.
        """
        try:
            image = QtGui.QImage()
            image.loadFromData(png, 'PNG')
        except __HOLE__:
            self._insert_plain_text(cursor, 'Received invalid PNG data.')
        else:
            format = self._add_image(image)
            cursor.insertBlock()
            cursor.insertImage(format)
            cursor.insertBlock()
dataset/ETHPy150Open ipython/ipython-py3k/IPython/frontend/qt/console/rich_ipython_widget.py/RichIPythonWidget._insert_png