Returns all subsets of given set.

    :return: Powerset of given set, i.e. iterable containing all its subsets,
             sorted by ascending cardinality.

def power(set_):
    """Returns all subsets of given set.

    :return: Powerset of given set, i.e. iterable containing all its subsets,
             sorted by ascending cardinality.
    """
    ensure_countable(set_)

    result = chain.from_iterable(combinations(set_, r)
                                 for r in xrange(len(set_) + 1))
    return _harmonize_subset_types(set_, result)