def cache_tip_names(tree):
 if hasattr(tree, '_tip_names'):
  return
 else:
  for n in tree.postorder():
   if n.isTip():
    n._tip_names = [n.Name]
   else:
    n._tip_names = reduce(add, [c._tip_names for c in n.Children])

def cache_tip_names ( tree ) : if hasattr ( tree , '_tip_names' ) : return else : for n in tree . postorder ( ) : if n . isTip ( ) : n . _tip_names = [ n . Name ] else : n . _tip_names = reduce ( add , [ c . _tip_names for c in n . Children ] )
cache tip names .