'Determine the depth of a hierarchy
@param node_id: the start node (default to all root nodes)'

def depth(self, node_id, level=0):

    nodes = self.nodes
    depth = self.depth
    node = nodes.get(node_id)
    if (not node):
        roots = self.roots
        result = max((depth(root) for root in roots))
    else:
        children = node['s']
        if children:
            result = max((depth(n, level=(level + 1)) for n in children))
        else:
            result = level
    return result
