code: def clusters(l, K):
      
      if l:
          prev = None
          for t in clusters(l[1:], K):
              tup = sorted(t)
              if tup != prev:
                  prev = tup
                  for i in range(K):
                      yield tup[:i] + [[l[0]] + tup[i], ] + tup[i+1:]
      else:
          yield [[] for _ in range(K)]
docs: Partition list ``l`` in ``K`` partitions.
      >>> l = [0, 1, 2]
      >>> list(clusters(l, K=3))
      [[[0], [1], [2]], [[], [0, 1], [2]], [[], [1], [0, 2]], [[0], [], [1, 2]], [[], [0], [1, 2]], [[], [], [0, 1, 2]]]
      >>> list(clusters(l, K=2))
      [[[0, 1], [2]], [[1], [0, 2]], [[0], [1, 2]], [[], [0, 1, 2]]]
      >>> list(clusters(l, K=1))
      [[[0, 1, 2]]]