code: def pretty_unicode(string):
      
      if isinstance(string, six.text_type):
          return string
      try:
          return string.decode("utf8")
      except UnicodeDecodeError:
          return string.decode('Latin-1').encode('unicode_escape').decode("utf8")
docs: Make sure string is unicode, try to decode with utf8, or unicode escaped string if failed.