def decode_utf8(string):
 if isinstance(string, str):
  for encoding in (('utf-8',), ('windows-1252',), ('utf-8', 'ignore')):
   try:
    return string.decode(*encoding)
   except:
    pass
  return string
 return unicode(string)

def decode_utf8 ( string ) : if isinstance ( string , str ) : for encoding in ( ( 'utf-8' , ) , ( 'windows-1252' , ) , ( 'utf-8' , 'ignore' ) ) : try : return string . decode ( * encoding ) except : pass return string return unicode ( string )
returns the given string as a unicode string .