def create_substitution_leaf(leaf, new_elements, new_model=None, internal=False):
 if (new_model is None):
  new_model = leaf.model
 new_join_context = [tuple(context) for context in leaf.join_context]
 new_leaf = ExtendedLeaf(new_elements, new_model, join_context=new_join_context, internal=internal)
 return new_leaf

def create_substitution_leaf ( leaf , new_elements , new_model = None , internal = False ) : if ( new_model is None ) : new_model = leaf . model new_join_context = [ tuple ( context ) for context in leaf . join_context ] new_leaf = ExtendedLeaf ( new_elements , new_model , join_context = new_join_context , internal = internal ) return new_leaf
from a leaf .