def GetSize(tree):
    """return the length of the tree. This is the maximum node_id + 1.

    This quantity is useful for tree traversal while updating
    a container.
    """
    return max(tree.chain.keys()) + 1