'Adds a new node to the tree. If the conn_type is the same as the root\'s
current connector type, the node is added to the first level.
Otherwise, the whole tree is pushed down one level and a new root
connector is created, connecting the existing tree and the new node.'

def add(self, node, conn_type):

    if ((node in self.children) and (conn_type == self.connector)):
        return
    if (len(self.children) < 2):
        self.connector = conn_type
    if (self.connector == conn_type):
        if (isinstance(node, Node) and ((node.connector == conn_type) or (len(node) == 1))):
            self.children.extend(node.children)
        else:
            self.children.append(node)
    else:
        obj = self._new_instance(self.children, self.connector, self.negated)
        self.connector = conn_type
        self.children = [obj, node]
