parameters: (value: Union[None, str, bytes])
return_statement: return value.encode("utf-8")
docstring: 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.
docstring_summary: Converts a string argument to a byte string.
docstring_tokens: Converts a string argument to a byte string .
function: def utf8(value: Union[None, str, bytes]) -> Optional[bytes]:  # noqa: F811
      """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.
      """
      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")
function_tokens: def utf8 ( value : Union [ None , str , bytes ] ) -> Optional [ bytes ] : # noqa: F811 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" )