def powerset(iterable):
    'powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)'
    s = list(iterable)
    return chain.from_iterable((combinations(s, r) for r in range((len(s) + 1))))
powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)
def powerset(iterable):
    
    s = list(iterable)
    return chain.from_iterable((combinations(s, r) for r in range((len(s) + 1))))