def powerset(U):
    """Generates all subsets of a set or sequence U."""
    U = iter(U)
    try:
        x = frozenset([U.next()])
        for S in powerset(U):
            yield S
            yield S | x
    except __HOLE__:
        yield frozenset()
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_set.py/powerset