def decorate_numtips(tree):
 for n in tree.postorder(include_self=True):
  if n.istip():
   n.Score = 1
  else:
   n.Score = len(n.tips())
 return tree

def decorate_numtips ( tree ) : for n in tree . postorder ( include_self = True ) : if n . istip ( ) : n . Score = 1 else : n . Score = len ( n . tips ( ) ) return tree
this function maps the number of children for each node .