def reservation_scope(namespace, binding):
    """
    Get the namespaces that are in the bindings reservation scope

    Returns the namespace nodes the binding name must be resolvable in

    :param namespace: The local namespace of a binding
    :type namespace: :class:`ast.AST`
    :param binding: The binding to get the reservation scope for
    :type binding: Binding
    :rtype: set[ast.AST]

    """
    namespaces = set([namespace])
    for node in binding.references:
        while node is not namespace:
            namespaces.add(node.namespace)
            node = node.namespace
    return namespaces
