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

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 .