import ast


def check_locals(node):
    """
    Checks if there is a call to `locals()`.
    The check is not perfect has there might be local or global
    variables with that name.
    """       
    class Visitor(ast.NodeVisitor):
        
        def __init__(self):
            self.found = False
        
        def visit_Call(self, node):
            self.generic_visit(node)
            if isinstance(node.func, ast.Name):
                if node.func.id == "locals":
                    self.found = True

            
    visitor = Visitor()
    visitor.visit(node)
    return visitor.found