def leaves(tree, branches=attrgetter('branches')):
 return (node for node in postorder(tree, branches) if node.is_leaf)

def leaves ( tree , branches = attrgetter ( 'branches' ) ) : return ( node for node in postorder ( tree , branches ) if node . is_leaf )
return an iterator over the leaf nodes in a tree structure .