environment/lib/python2.7/site-packages/IPython/frontend/qt/rich_text.py
def ensure_utf8(image_tag):
    """wrapper for ensuring image_tag returns utf8-encoded str on Python 2"""
    if py3compat.PY3:
        # nothing to do on Python 3
        return image_tag
    
    def utf8_image_tag(*args, **kwargs):
        s = image_tag(*args, **kwargs)
        if isinstance(s, unicode):
            s = s.encode('utf8')
        return s
    return utf8_image_tag
def ensure_utf8(image_tag):
    """wrapper for ensuring image_tag returns utf8-encoded str on Python 2"""
    if py3compat.PY3:
        # nothing to do on Python 3
        return image_tag
    
    def utf8_image_tag(*args, **kwargs):
        s = image_tag(*args, **kwargs)
        if isinstance(s, unicode):
            s = s.encode('utf8')
        return s
    return utf8_image_tag
wrapper for ensuring image_tag returns utf8-encoded str on Python 2