def _filter_domain_id_from_parents(domain_id, tree):
 new_tree = None
 if tree:
  (parent, children) = next(iter(tree.items()))
  if (parent != domain_id):
   new_tree = {parent: _filter_domain_id_from_parents(domain_id, children)}
 return new_tree

def _filter_domain_id_from_parents ( domain_id , tree ) : new_tree = None if tree : ( parent , children ) = next ( iter ( tree . items ( ) ) ) if ( parent != domain_id ) : new_tree = { parent : _filter_domain_id_from_parents ( domain_id , children ) } return new_tree
removes the domain_id from the tree if present .