'Get the parent node of a node
@param node_id: the node ID
@param classify: return the root node as tuple (id, category)
instead of just id
@return: the root node ID (or tuple (id, category), respectively)'

def parent(self, node_id, classify=False):

    nodes = self.nodes
    default = ((None, None) if classify else None)
    node = nodes.get(node_id)
    if (not node):
        return default
    parent_id = node['p']
    if (not parent_id):
        return default
    parent_node = nodes.get(parent_id)
    if (not parent_node):
        return default
    parent_category = parent_node['c']
    return ((parent_id, parent_category) if classify else parent_id)
