'Closes off the most recently unmatched start_subtree() call.
This puts the current state into a node of the parent tree and returns
the current instances state to be the parent.'

def end_subtree(self):

    obj = self.subtree_parents.pop()
    node = self.__class__(self.children, self.connector)
    self.connector = obj.connector
    self.negated = obj.negated
    self.children = obj.children
    self.children.append(node)
