# 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):


import itertools
from mom import builtins
  from itertools import izip
  from itertools import starmap
  try:
    for tup in izip(*iters):
      yield tup
  except IndexError:
    pass


def permutations(iterable, r=None):
  """Return successive `r` length permutations of elements in the `iterable`.

  If `r` is not specified or is ``None``, then `r` defaults to the length of
  the `iterable` and all possible full-length permutations are generated.

  Permutations are emitted in lexicographic sort order. So, if the input
  `iterable` is sorted, the permutation tuples will be produced in sorted
  order.

  Elements are treated as unique based on their position, not on their
  value. So if the input elements are unique, there will be no repeating
  value in each permutation.

  The number of items returned is ``n! / (n - r)!`` when ``0 <= r <= n`` or
  zero when `r > n`.

  .. note:: Software and documentation for this function are taken from
            CPython, :ref:`license details <psf-license>`.
  """
  pool = tuple(iterable)
  pool_length = len(pool)
  r = pool_length if r is None else r

# 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/itertools.py
import itertools
from mom import builtins
  from itertools import izip
  from itertools import starmap

  try:
    for tup in izip(*iters):
      yield tup
  except IndexError:
    pass


def permutations(iterable, r=None):
  """Return successive `r` length permutations of elements in the `iterable`.

  If `r` is not specified or is ``None``, then `r` defaults to the length of
  the `iterable` and all possible full-length permutations are generated.

  Permutations are emitted in lexicographic sort order. So, if the input
  `iterable` is sorted, the permutation tuples will be produced in sorted
  order.

  Elements are treated as unique based on their position, not on their
  value. So if the input elements are unique, there will be no repeating
  value in each permutation.

  The number of items returned is ``n! / (n - r)!`` when ``0 <= r <= n`` or
  zero when `r > n`.

  .. note:: Software and documentation for this function are taken from
            CPython, :ref:`license details <psf-license>`.
  """
  pool = tuple(iterable)
  pool_length = len(pool)
  r = pool_length if r is None else r

  for indices in product(builtins.range(pool_length), repeat=r):