def _leftmost_descendants(node):
 try:
  treepos = node.treepositions()
 except AttributeError:
  return []
 return [node[x] for x in treepos[1:] if all(((y == 0) for y in x))]

def _leftmost_descendants ( node ) : try : treepos = node . treepositions ( ) except AttributeError : return [ ] return [ node [ x ] for x in treepos [ 1 : ] if all ( ( ( y == 0 ) for y in x ) ) ]
returns the set of all nodes descended in some way through left branches from this node .