Return a copy of the subtree rooted at ``node``

        Args:
            ``node`` (``Node``): The root of the desired subtree

        Returns:
            ``Tree``: A copy of the subtree rooted at ``node``
439574
def extract_subtree(self, node):
        '''
        '''
        if not isinstance(node, Node):
            raise TypeError("node must be a Node")
        r = self.root; self.root = node; o = copy(self); self.root = r; return o
533601
def copyNode(node, children=False, parent=False):
    
    if parent is not False:
        element = SubElement(
            parent,
            node.tag,
            attrib=node.attrib,
            nsmap={None: "http://www.tei-c.org/ns/1.0"}
        )
    else:
        element = Element(
            node.tag,
            attrib=node.attrib,
            nsmap={None: "http://www.tei-c.org/ns/1.0"}
        )
    if children:
        if node.text:
            element._setText(node.text)
        for child in xmliter(node):
            element.append(copy(child))
    return element
768847
def assignment(self, node, children):
        ''
        lvalue, _, expr = children
        self.env[lvalue] = expr
        return expr
1356096
def _to_dict(self, node):
        
        if node == BLANK_NODE:
            return {}

        node_type = self._get_node_type(node)

        if is_key_value_type(node_type):
            nibbles = without_terminator(unpack_to_nibbles(node[0]))
            key = b'+'.join([to_string(x) for x in nibbles])
            if node_type == NODE_TYPE_EXTENSION:
                sub_dict = self._to_dict(self._decode_to_node(node[1]))
            else:
                sub_dict = {to_string(NIBBLE_TERMINATOR): node[1]}

            # prepend key of this node to the keys of children
            res = {}
            for sub_key, sub_value in sub_dict.items():
                full_key = (key + b'+' + sub_key).strip(b'+')
                res[full_key] = sub_value
            return res

        elif node_type == NODE_TYPE_BRANCH:
            res = {}
            for i in range(16):
                sub_dict = self._to_dict(self._decode_to_node(node[i]))

                for sub_key, sub_value in sub_dict.items():
                    full_key = (
                        str_to_bytes(
                            str(i)) +
                        b'+' +
                        sub_key).strip(b'+')
                    res[full_key] = sub_value

            if node[16]:
                res[to_string(NIBBLE_TERMINATOR)] = node[-1]
            return res
443909
def find(node):
    
    if node.parent is None:
        return node
    root = node
    while root.parent is not None:
        root = root.parent
    parent = node
    while parent.parent is not root:
        grandparent = parent.parent
        parent.parent = root
        parent = grandparent
    return root
1032876
def tree(self):
        
        from cmdtree.tree import CmdTree
        if self._tree is None:
            self._tree = CmdTree()
        return self._tree
915378
def root(self):
        
        node = self
        while node.package is not None:
            node = node.package
        return node
533943
def subtree(self, event, create = False):
        '''
        
        '''
        current = self
        for i in range(self.depth, len(event.indices)):
            if not hasattr(current, 'index'):
                return current
            ind = event.indices[i]
            if create:
                current = current.index.setdefault(ind, EventTree(current, self.branch))
                current.parentIndex = ind
            else:
                current = current.index.get(ind)
                if current is None:
                    return None
        return current
821853
def clone(self):
        """"""
        return Node(self.type, [ch.clone() for ch in self.children],
                    fixers_applied=self.fixers_applied)
181534
def get_subtree(self, root):
        
        if not isinstance(root, Tree):
            self.log_exc(u"root is not an instance of Tree", None, True, TypeError)
        new_text_file = TextFile()
        new_text_file.fragments_tree = root
        return new_text_file
252974
def get_node_index(self, node):
        

        if node == self.__root_node:
            return QModelIndex()
        else:
            row = node.row()
            return self.createIndex(row, 0, node) if row is not None else QModelIndex()
897876
def __get_node(self, word):
		

		node = self.root
		for c in word:
			try:
				node = node.children[c]
			except KeyError:
				return None

		return node
331011
def node(self):
        

        if self.node_class is None:
            raise ValueError("You have to create an ``Item`` by calling ``__init__`` with ``node_class`` argument"
                             " or by decorating a ``Node`` class.")

        node = self.node_class(*self.node_args, **self.node_kwargs)
        node.__item__ = self

        return node
498327
def translate(self, node):
        
        _translate = self._translate_functions.get(node.operator)
        return _translate(node)
1093247
def get_node(self, key):
        
        self._check_if_open()
        try:
            if not key.startswith('/'):
                key = '/' + key
            return self._handle.get_node(self.root, key)
        except _table_mod.exceptions.NoSuchNodeError:
            return None
280525
def get_at(self, root_node, key):
        
        return self._get(root_node, bin_to_nibbles(to_string(key)))
783048
def getRootNode(nodes):
    ''''''
    max = 0
    root = None
    for i in nodes:
        if len(i.children) > max:
            max = len(i.children)
            root = i
    return root