# 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
# class chain(object):
#   """An iterator which yields elements from the given `iterables` until each
#   iterable is exhausted.
# 
#   .. versionadded:: 0.2
#   """
# 
#   @classmethod
#   def from_iterable(cls, iterable):
#     """Alternative constructor which takes an `iterable` yielding iterators,
#     this can be used to chain an infinite number of iterators.
#     """
#     rv = object.__new__(cls)
#     rv._init(iterable)
#     return rv
# 
#   def __init__(self, *iterables):
#     self._init(iterables)
# 
#   def _init(self, iterables):
#     self.iterables = iter(iterables)
#     self.current_iterable = iter([])
# 
#   def __iter__(self):
#     return self
# 
#   def next(self):
#     try:
#       return self.current_iterable.next()
#     except StopIteration:
#       self.current_iterable = iter(self.iterables.next())
#       return self.current_iterable.next()
# 
# Path: mom/itertools.py
# def starmap(function, iterable):
#   """Make an iterator that computes the function using arguments obtained from
#   the iterable. Used instead of :func:`itertools.imap` when an argument
#   parameters are already grouped in tuples from a single iterable (the data
#   has been "pre-zipped"). The difference between :func:`itertools.imap` and
#   :func:`starmap` parallels the distinction between ``function(a, b)`` and
#   ``function(*c)``.
# 
#   .. note:: Software and documentation for this function are taken from
#             CPython, :ref:`license details <psf-license>`.
#   """
#   for args in iterable:
#     yield function(*args)


import collections
import functools
import itertools
  from itertools import ifilter as _ifilter
  from itertools import ifilterfalse as _ifilterfalse
  from itertools import imap as map
from mom import builtins
from mom.itertools import chain
from mom.itertools import starmap
  one dictionary the predicate is true and for those of the other it is false.

  :param predicate:
      Function of the format::

          f(key, value) -> bool

  :param dictionary:
      Dictionary.
  :returns:
      Tuple (selected_dict, rejected_dict)
  """

  def _pred(tup):
    """Apply arguments to predicate."""
    return predicate(*tup)

  pairs_a, pairs_b = partition(_pred, dictionary.items())
  return dict(pairs_a), dict(pairs_b)


def map_dict(transform, dictionary):
  """Maps over a dictionary of key, value pairs.

  :param transform:
      Function that accepts two arguments ``key, value``
      and returns a ``(new key, new value)`` pair.
  :returns:
      New dictionary of ``new key=new value`` pairs.
  """

# 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
# class chain(object):
#   """An iterator which yields elements from the given `iterables` until each
#   iterable is exhausted.
# 
#   .. versionadded:: 0.2
#   """
# 
#   @classmethod
#   def from_iterable(cls, iterable):
#     """Alternative constructor which takes an `iterable` yielding iterators,
#     this can be used to chain an infinite number of iterators.
#     """
#     rv = object.__new__(cls)
#     rv._init(iterable)
#     return rv
# 
#   def __init__(self, *iterables):
#     self._init(iterables)
# 
#   def _init(self, iterables):
#     self.iterables = iter(iterables)
#     self.current_iterable = iter([])
# 
#   def __iter__(self):
#     return self
# 
#   def next(self):
#     try:
#       return self.current_iterable.next()
#     except StopIteration:
#       self.current_iterable = iter(self.iterables.next())
#       return self.current_iterable.next()
# 
# Path: mom/itertools.py
# def starmap(function, iterable):
#   """Make an iterator that computes the function using arguments obtained from
#   the iterable. Used instead of :func:`itertools.imap` when an argument
#   parameters are already grouped in tuples from a single iterable (the data
#   has been "pre-zipped"). The difference between :func:`itertools.imap` and
#   :func:`starmap` parallels the distinction between ``function(a, b)`` and
#   ``function(*c)``.
# 
#   .. note:: Software and documentation for this function are taken from
#             CPython, :ref:`license details <psf-license>`.
#   """
#   for args in iterable:
#     yield function(*args)


# Path: mom/functional.py
import collections
import functools
import itertools
  from itertools import ifilter as _ifilter
  from itertools import ifilterfalse as _ifilterfalse
  from itertools import imap as map
from mom import builtins
from mom.itertools import chain
from mom.itertools import starmap

  one dictionary the predicate is true and for those of the other it is false.

  :param predicate:
      Function of the format::

          f(key, value) -> bool

  :param dictionary:
      Dictionary.
  :returns:
      Tuple (selected_dict, rejected_dict)
  """

  def _pred(tup):
    """Apply arguments to predicate."""
    return predicate(*tup)

  pairs_a, pairs_b = partition(_pred, dictionary.items())
  return dict(pairs_a), dict(pairs_b)


def map_dict(transform, dictionary):
  """Maps over a dictionary of key, value pairs.

  :param transform:
      Function that accepts two arguments ``key, value``
      and returns a ``(new key, new value)`` pair.
  :returns:
      New dictionary of ``new key=new value`` pairs.
  """

  return dict(starmap(transform or (lambda k, v: (k, v)),