def safe_unicode(obj, *args):
        """ return the unicode representation of obj """
        try:
            return unicode(obj, *args)
        except UnicodeDecodeError:
            # obj is byte string
            ascii_text = str(obj).encode('string_escape')
            return unicode(ascii_text)
 return the unicode representation of obj 
stackoverflow/venv/lib/python3.6/site-packages/redis/_compat.py