def complement(predicate):
  """Generates a complementary predicate function for the given predicate
  function.

  :param predicate:
      Predicate function.
  :returns:
      Complementary predicate function.
  """

  def _negate(*args, **kwargs):
    """Negation."""
    return not predicate(*args, **kwargs)

  return _negate