code: def powerset(iterable, *, reverse=False):
      
      lst = list(iterable)
      if reverse:
          rng = range(len(lst), -1, -1)
      else:
          rng = range(len(lst) + 1)
      return chain.from_iterable(combinations(lst, r) for r in rng)
docs: Return the powerset.
  
      Arguments
      ---------
      iterable : iterable
      reverse  : boolean
                 Indicates whether the powerset should be returned descending by
                 size
  
      Returns
      -------
      A generator producing each element of the powerset.