import itertools


def _Powerset(input_list):
  """Create powerset iterator from the elements in a list.

  Note: Based on example in official Python itertools documentation.

  Example:
    [p for p in Powerset(['a', 'b')] == [(), ('a',), ('b'), ('a', 'b')]

  Args:
    input_list: A sequence of Python objects

  Returns:
    An iterator which loops through all (tuple) elements in the powerset of
    the input_list.
  """
  return (
      itertools.chain.from_iterable(
          itertools.combinations(input_list, r) for r
          in range(len(input_list) + 1)))