code: def _utf8(value):
      
      if isinstance(value, _UTF8_TYPES):
          return value
      if not isinstance(value, unicode_type):
          raise TypeError(
              "Expected bytes, unicode, or None; got %r" % type(value)
          )
      return value.encode("utf-8")
docs: Converts a string argument to a byte string.
  
      If the argument is already a byte string or None, it is returned unchanged.
      Otherwise it must be a unicode string and is encoded as utf8.