def insert_child(self, i: int, child: NL) -> None:
        """
        Equivalent to 'node.children.insert(i, child)'. This method also sets
        the child's parent attribute appropriately.
        """
        child.parent = self
        self.children.insert(i, child)
        self.changed()
        self.invalidate_sibling_maps()

        Equivalent to 'node.children.insert(i, child)'. This method also sets
        the child's parent attribute appropriately.
        
src/blib2to3/pytree.py