'Add t as child of this node.
Warning: if t has no children, but child does
and child isNil then this routine moves children to t via
t.children = child.children; i.e., without copying the array.'

def addChild(self, childTree):

    if (childTree is None):
        return
    if childTree.isNil():
        if (self.children is childTree.children):
            raise ValueError('attempt    to    add    child    list    to    itself')
        for (idx, child) in enumerate(childTree.children):
            child.parent = self
            child.childIndex = (len(self.children) + idx)
        self.children += childTree.children
    else:
        self.children.append(childTree)
        childTree.parent = self
        childTree.childIndex = (len(self.children) - 1)
