code: def _detach_children(self):
          
          children = [val[0] for val in self._children.values()]
          for child in children:
              child()._parent = list(self)
          self._children.clear()
docs: Remove all children and give them independent parent copies.