def in_scope(graph, node, parent):
    """ Returns True if `node` is in the scope of `parent`. """
    scope_dict = graph.scope_dict()
    scope = scope_dict[node]
    while scope is not None:
        if scope == parent:
            return True
        scope = scope_dict[scope]
    return False