code: def text(value, encoding="utf-8", errors="strict"):
      
      if isinstance(value, text_type):
          return value
      elif isinstance(value, bytes):
          return text_type(value, encoding, errors)
      else:
          return text_type(value)
docs: Convert a value to str on Python 3 and unicode on Python 2.