'Return whether the given transform is a sub-tree of this transform.
This routine uses transform equality to identify sub-trees, therefore
in many situations it is object id which will be used.
For the case where the given transform represents the whole
of this transform, returns True.'

def contains_branch(self, other):

    if (self.depth < other.depth):
        return False
    for (_, sub_tree) in self._iter_break_from_left_to_right():
        if (sub_tree == other):
            return True
    return False
