code: def _unicode(string):
      
      for encoding in ['utf-8', 'latin1']:
          try:
              result = unicode(string, encoding)
              return result
          except UnicodeDecodeError:
              pass
      result = unicode(string, 'utf-8', 'replace')
      return result
docs: Try to convert a string to unicode using different encodings