def list_visitor(state, components):
    f, lpart, pstack = state

    partition = []
    for i in range(lpart+1):
        part = []
        for ps in pstack[f[i]:f[i+1]]:
            if ps.v > 0:
                part.extend([components[ps.c]] * ps.v)
        partition.append(part)

    return partition
Return a list of lists to represent the partition.
dataset/ETHPy150Open sympy/sympy/sympy/utilities/enumerative.py/list_visitor