code: def unicodestr(s, encoding='utf-8', fallback='iso-8859-1'):
      
  
      if isinstance(s, unicode):
          return s
  
      try:
          return s.decode(encoding)
      except UnicodeError:
          return s.decode(fallback)
docs: Convert a string to unicode if it isn't already.