def reparent(self, item): # should not be necessary if isinstance(item, KVPair): Node.reparent(self, item.key) Node.reparent(self, item.value) else: Node.reparent(self, item)