def _check_nonlocal_without_binding(self, node, name):
    current_scope = node.scope()
    while True:
        if (current_scope.parent is None):
            break
        if (not isinstance(current_scope, (astroid.ClassDef, astroid.FunctionDef))):
            self.add_message('nonlocal-without-binding', args=(name,), node=node)
            return
        if (name not in current_scope.locals):
            current_scope = current_scope.parent.scope()
            continue
        return
    if (not isinstance(current_scope, astroid.FunctionDef)):
        self.add_message('nonlocal-without-binding', args=(name,), node=node)
def _check_nonlocal_without_binding(self, node, name):
    current_scope = node.scope()
    while True:
        if (current_scope.parent is None):
            break
        if (not isinstance(current_scope, (astroid.ClassDef, astroid.FunctionDef))):
            self.add_message('nonlocal-without-binding', args=(name,), node=node)
            return
        if (name not in current_scope.locals):
            current_scope = current_scope.parent.scope()
            continue
        return
    if (not isinstance(current_scope, astroid.FunctionDef)):
        self.add_message('nonlocal-without-binding', args=(name,), node=node)