'Creates a clone of the tree. Must only be called on root nodes (nodes
with empty subtree_parents). Childs must be either (Contraint, lookup,
value) tuples, or objects supporting .clone().'

def clone(self):

    clone = self.__class__._new_instance(children=[], connector=self.connector, negated=self.negated)
    for child in self.children:
        if hasattr(child, 'clone'):
            clone.children.append(child.clone())
        else:
            clone.children.append(child)
    return clone
