code: def safe_unicode(value):
      
      if sys.version_info < (3,0):
          if isinstance(value, str):
              return value.decode('utf-8')
          else:
              return unicode(value)
      else:
          return str(value)
docs: Returns:
  
      * a `unicode` instance in Python 2.x, or
      * a `str` instance in Python 3.x.