def cut_levels(nodes, level):
 if nodes:
  if (nodes[0].level == level):
   return nodes
 return sum((cut_levels(node.children, level) for node in nodes), [])

def cut_levels ( nodes , level ) : if nodes : if ( nodes [ 0 ] . level == level ) : return nodes return sum ( ( cut_levels ( node . children , level ) for node in nodes ) , [ ] )
for cutting the nav_extender levels if you have a from_level in the navigation .