def _handle_display_data(self, msg):
        """Overridden to handle rich data types, like SVG."""
        self.log.debug("display_data: %s", msg.get('content', ''))
        if self.include_output(msg):
            self.flush_clearoutput()
            data = msg['content']['data']
            metadata = msg['content']['metadata']
            # Try to use the svg or html representations.
            # FIXME: Is this the right ordering of things to try?
            self.log.debug("display: %s", msg.get('content', ''))
            if 'image/svg+xml' in data:
                svg = data['image/svg+xml']
                self._append_svg(svg, True)
            elif 'image/png' in data:
                # PNG data is base64 encoded as it passes over the network
                # in a JSON structure so we decode it.
                png = b64decode(data['image/png'].encode('ascii'))
                self._append_png(png, True, metadata=metadata.get('image/png', None))
            elif 'image/jpeg' in data and self._jpg_supported:
                jpg = b64decode(data['image/jpeg'].encode('ascii'))
                self._append_jpg(jpg, True, metadata=metadata.get('image/jpeg', None))
            elif 'text/latex' in data and latex_to_png:
                try:
                    self._append_latex(data['text/latex'], True)
                except LatexError:
                    return super()._handle_display_data(msg)
            else:
                # Default back to the plain text representation.
                return super()._handle_display_data(msg)
Overridden to handle rich data types, like SVG.
angrmanagement/vendor/qtconsole/rich_jupyter_widget.py