def powerset(iterable, include_empty=True):
 s = list(iterable)
 i = chain.from_iterable((combinations(s, r) for r in range((len(s) + 1))))
 if (not include_empty):
  next(i)
 return i

def powerset ( iterable , include_empty = True ) : s = list ( iterable ) i = chain . from_iterable ( ( combinations ( s , r ) for r in range ( ( len ( s ) + 1 ) ) ) ) if ( not include_empty ) : next ( i ) return i
generates all subsets of a set or sequence u .