This returns the first top level Indicator node under the criteria node.

    :param root_node: Root node of an etree.
    :return: an elementTree Element item, or None if no item is found.
509037
def get_top_level_indicator_node(root_node):
    
    if root_node.tag != 'OpenIOC':
        raise IOCParseError('Root tag is not "OpenIOC" [{}].'.format(root_node.tag))
    elems = root_node.xpath('criteria/Indicator')
    if len(elems) == 0:
        log.warning('No top level Indicator node found.')
        return None
    elif len(elems) > 1:
        log.warning('Multiple top level Indicator nodes found.  This is not a valid MIR IOC.')
        return None
    else:
        top_level_indicator_node = elems[0]
    if top_level_indicator_node.get('operator').lower() != 'or':
        log.warning('Top level Indicator/@operator attribute is not "OR".  This is not a valid MIR IOC.')
    return top_level_indicator_node
471285
def root(self):
            
            str_treeRoot                = '/'
            self.l_cwd                  = [str_treeRoot]
            self.snode_current          = self.snode_root
            self.sbranch_current        = self.sbranch_root
270914
def searchRootOfTree(reducibleChildren: Set[LNode], nodeFromTree: LNode):
    

    while True:
        out_e = nodeFromTree.east[0].outgoingEdges
        # node has no successors
        if not out_e:
            return nodeFromTree

        nextNode = out_e[0].dsts[0].parentNode
        if nextNode in reducibleChildren:
            # can reduce node, walk the tree to root
            nodeFromTree = nextNode
        else:
            # can not reduce, return last root of tree
            return nodeFromTree
1206887
def is_sibling_of(self, node):
        
        aux = self.depth == node.depth
        # Check non-root nodes share a parent only if they have the same depth
        if aux and self.depth > 1:
            # making sure the non-root nodes share a parent
            parentpath = self._get_basepath(self.path, self.depth - 1)
            return aux and node.path.startswith(parentpath)
        return aux
1032150
def get_root_graph(self,root):
      """"""
      children = self.get_children(root)
      g = Graph()
      nodes = [root]+children
      for node in nodes: g.add_node(node)
      node_ids = [x.id for x in nodes]
      edges = [x for x in self._edges.values() if x.node1.id in node_ids and x.node2.id in node_ids]
      for e in edges: g.add_edge(e)
      return g
298777
public Tree findHead(Tree parentNode) {
        Tree cursor = parentNode.getType().equals("TOP") ? parentNode.firstChild() : parentNode;

        while (cursor.children() != null && !cursor.children().isEmpty())
            cursor = findHead2(cursor);

        return cursor;
    }
1100403
def roots(self):
        
        if not self.is_tagged(ANALYSIS):
            self.tag_analysis()
        return self.get_analysis_element(ROOT)
719763
def get_root_item(self, item):
        """"""
        root_item = item
        while isinstance(root_item.parent(), QTreeWidgetItem):
            root_item = root_item.parent()
        return root_item
794614
def root_parent(self, category=None):
        
        return next(filter(lambda c: c.is_root, self.hierarchy()))
1151765
def getRootElement(self):
        
        ret = libxml2mod.xmlDocGetRootElement(self._o)
        if ret is None:raise treeError('xmlDocGetRootElement() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
280525
def get_at(self, root_node, key):
        
        return self._get(root_node, bin_to_nibbles(to_string(key)))
405332
def get_root(w):
    
    next_level = w
    while next_level.master:
        next_level = next_level.master
    return next_level
1197993
def root(self):
        

        if not self.parent:
            return self

        con = self.parent

        while con.parent:
            con = con.parent

        return con
385861
def root(self):
        
        root = self
        while root.parent is not None:
            root = root.parent
        return root
915378
def root(self):
        
        node = self
        while node.package is not None:
            node = node.package
        return node
110566
def find_node(self, attribute):
        

        for model in GraphModel._GraphModel__models_instances.itervalues():
            for node in foundations.walkers.nodes_walker(model.root_node):
                if attribute in node.get_attributes():
                    return node
522062
def detect(self, root_device='/'):
        
        root = Device(None, [], None, "", [])
        device_nodes = dict(map(self._device_node,
                                self._mounter.get_all_handleable()))
        # insert child devices as branches into their roots:
        for node in device_nodes.values():
            device_nodes.get(node.root, root).branches.append(node)
        device_nodes['/'] = root
        for node in device_nodes.values():
            node.branches.sort(key=lambda node: node.label)
        return device_nodes[root_device]