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')

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' )
make sure string is unicode .