def get_tree_details(nodes):
 if hasattr(nodes, u'order_by'):
  nodes = list(nodes.order_by(u'tree_id', u'lft', u'pk'))
 nodes = list(nodes)
 opts = nodes[0]._mptt_meta
 return u'\n'.join([(u'%s %s %s %s %s %s' % (n.pk, (getattr(n, (u'%s_id' % opts.parent_attr)) or u'-'), getattr(n, opts.tree_id_attr), getattr(n, opts.level_attr), getattr(n, opts.left_attr), getattr(n, opts.right_attr))) for n in nodes])

def get_tree_details ( nodes ) : if hasattr ( nodes , u'order_by' ) : nodes = list ( nodes . order_by ( u'tree_id' , u'lft' , u'pk' ) ) nodes = list ( nodes ) opts = nodes [ 0 ] . _mptt_meta return u'\n' . join ( [ ( u'%s %s %s %s %s %s' % ( n . pk , ( getattr ( n , ( u'%s_id' % opts . parent_attr ) ) or u'-' ) , getattr ( n , opts . tree_id_attr ) , getattr ( n , opts . level_attr ) , getattr ( n , opts . left_attr ) , getattr ( n , opts . right_attr ) ) ) for n in nodes ] )
creates pertinent tree details for the given list of nodes .