# Path: mom/builtins.py
# def byte(number):
# def bytes_leading(raw_bytes, needle=_compat.ZERO_BYTE):
# def bytes_trailing(raw_bytes, needle=_compat.ZERO_BYTE):
# def bin(number, prefix="0b"):
# def hex(number, prefix="0x"):
# def is_sequence(obj):
# def is_unicode(obj):
# def is_bytes(obj):
# def is_bytes_or_unicode(obj):
# def is_integer(obj):
# def integer_byte_length(number):
# def integer_byte_size(number):
# def integer_bit_length(number):
# def integer_bit_size(number):
# def integer_bit_count(number):
# def is_even(num):
# def is_odd(num):
# def is_positive(num):
# def is_negative(num):


from mom import builtins


__all__ = [
    "ascii_encode",
    "bytes_to_unicode",
    "bytes_to_unicode_recursive",
    "latin1_encode",
    "to_unicode_if_bytes",
    "utf8_decode",
    "utf8_decode_if_bytes",
    "utf8_decode_recursive",
    "utf8_encode",
    "utf8_encode_if_unicode",
    "utf8_encode_recursive",
    ]


def utf8_encode(unicode_text):
  """
  UTF-8 encodes a Unicode string into bytes; bytes and None are left alone.

  Work with Unicode strings in your code and encode your Unicode strings into
  UTF-8 before they leave your system.

  :param unicode_text:
      If already a byte string or None, it is returned unchanged.
      Otherwise it must be a Unicode string and is encoded as UTF-8 bytes.
  :returns:
      UTF-8 encoded bytes.
  """

# Path: mom/builtins.py
# def byte(number):
# def bytes_leading(raw_bytes, needle=_compat.ZERO_BYTE):
# def bytes_trailing(raw_bytes, needle=_compat.ZERO_BYTE):
# def bin(number, prefix="0b"):
# def hex(number, prefix="0x"):
# def is_sequence(obj):
# def is_unicode(obj):
# def is_bytes(obj):
# def is_bytes_or_unicode(obj):
# def is_integer(obj):
# def integer_byte_length(number):
# def integer_byte_size(number):
# def integer_bit_length(number):
# def integer_bit_size(number):
# def integer_bit_count(number):
# def is_even(num):
# def is_odd(num):
# def is_positive(num):
# def is_negative(num):


# Path: mom/codec/text.py
from mom import builtins



__all__ = [
    "ascii_encode",
    "bytes_to_unicode",
    "bytes_to_unicode_recursive",
    "latin1_encode",
    "to_unicode_if_bytes",
    "utf8_decode",
    "utf8_decode_if_bytes",
    "utf8_decode_recursive",
    "utf8_encode",
    "utf8_encode_if_unicode",
    "utf8_encode_recursive",
    ]


def utf8_encode(unicode_text):
  """
  UTF-8 encodes a Unicode string into bytes; bytes and None are left alone.

  Work with Unicode strings in your code and encode your Unicode strings into
  UTF-8 before they leave your system.

  :param unicode_text:
      If already a byte string or None, it is returned unchanged.
      Otherwise it must be a Unicode string and is encoded as UTF-8 bytes.
  :returns:
      UTF-8 encoded bytes.
  """

  if unicode_text is None or builtins.is_bytes(unicode_text):