# 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


def to_unicode_if_bytes(obj, encoding="utf-8"):
  """
  Decodes encoded bytes into a Unicode string.

  :param obj:
      The value that will be converted to a Unicode string.
  :param encoding:
      The encoding used to decode bytes. Defaults to UTF-8.
  :returns:
      Unicode string if the argument is a byte string. Otherwise the value
      is returned unchanged.
  """
  return bytes_to_unicode(obj, encoding) if builtins.is_bytes(obj) else obj


def bytes_to_unicode(raw_bytes, encoding="utf-8"):
  """
  Converts bytes to a Unicode string decoding it according to the encoding
  specified.

  :param raw_bytes:
      If already a Unicode string or None, it is returned unchanged.
      Otherwise it must be a byte string.
  :param encoding:
      The encoding used to decode bytes. Defaults to UTF-8
  """
  if raw_bytes is None or builtins.is_unicode(raw_bytes):
    return raw_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



def to_unicode_if_bytes(obj, encoding="utf-8"):
  """
  Decodes encoded bytes into a Unicode string.

  :param obj:
      The value that will be converted to a Unicode string.
  :param encoding:
      The encoding used to decode bytes. Defaults to UTF-8.
  :returns:
      Unicode string if the argument is a byte string. Otherwise the value
      is returned unchanged.
  """
  return bytes_to_unicode(obj, encoding) if builtins.is_bytes(obj) else obj


def bytes_to_unicode(raw_bytes, encoding="utf-8"):
  """
  Converts bytes to a Unicode string decoding it according to the encoding
  specified.

  :param raw_bytes:
      If already a Unicode string or None, it is returned unchanged.
      Otherwise it must be a byte string.
  :param encoding:
      The encoding used to decode bytes. Defaults to UTF-8
  """
  if raw_bytes is None or builtins.is_unicode(raw_bytes):
    return raw_bytes

  if not builtins.is_bytes(raw_bytes):