code: def partitions(iterable):
      
      sequence = list(iterable)
      n = len(sequence)
      for i in powerset(range(1, n)):
          yield [sequence[i:j] for i, j in zip((0,) + i, i + (n,))]
docs: Yield all possible partitions of *iterable*. This yields all the ways
      to split the iterable, starting with the full iterable, all splits into
      two pieces, all the splits into three pieces, and so on. Order is preserved
      and repeated elements are treated as distinct.
  
      >>> iterable = ['a', 'b', 'c', 'd']
      >>> for part in partitions(iterable):
      ...     print(part)
      [['a', 'b', 'c', 'd']]
      [['a'], ['b', 'c', 'd']]
      [['a', 'b'], ['c', 'd']]
      [['a', 'b', 'c'], ['d']]
      [['a'], ['b'], ['c', 'd']]
      [['a'], ['b', 'c'], ['d']]
      [['a', 'b'], ['c'], ['d']]
      [['a'], ['b'], ['c'], ['d']]
  
      This is unrelated to :func:`partition`.