def _RecAnnotate(tree, annotate_name, annotate_value):
 for child in tree.children:
  _RecAnnotate(child, annotate_name, annotate_value)
 if isinstance(tree, pytree.Leaf):
  cur_annotate = pytree_utils.GetNodeAnnotation(tree, annotate_name, default=0)
  if (cur_annotate < annotate_value):
   pytree_utils.SetNodeAnnotation(tree, annotate_name, annotate_value)

def _RecAnnotate ( tree , annotate_name , annotate_value ) : for child in tree . children : _RecAnnotate ( child , annotate_name , annotate_value ) if isinstance ( tree , pytree . Leaf ) : cur_annotate = pytree_utils . GetNodeAnnotation ( tree , annotate_name , default = 0 ) if ( cur_annotate < annotate_value ) : pytree_utils . SetNodeAnnotation ( tree , annotate_name , annotate_value )
recursively set the given annotation on all leafs of the subtree .