import itertools


def all_subsets(A, strict=True, null=True):
    """
    Return all subsets of A (list/tuple/etc).  If strict is False, result
    includes A, if null is True, includes ().
    """
    n = len(A)
    min = 0 if null else 1
    max = n if strict else n + 1
    out = []
    for m in range(min, max):
        out.append(itertools.combinations(A, m))
    return itertools.chain(*out)