def get_node_index(node):
    """
    get index of node in its parent's children
    """
    if node is None or node.parent is None:
        return -1
    for idx, child in enumerate(node.parent.children):
        if child is node:
            return idx
    return -1