def _rightmost_descendants(node):
 try:
  rightmost_leaf = max(node.treepositions())
 except AttributeError:
  return []
 return [node[rightmost_leaf[:i]] for i in range(1, (len(rightmost_leaf) + 1))]

def _rightmost_descendants ( node ) : try : rightmost_leaf = max ( node . treepositions ( ) ) except AttributeError : return [ ] return [ node [ rightmost_leaf [ : i ] ] for i in range ( 1 , ( len ( rightmost_leaf ) + 1 ) ) ]
returns the set of all nodes descended in some way through right branches from this node .