import ast


def check_deletevar(node):
    """
    Check if there is a delete statement for a variable. Deletes for
    attributes and subscripts don't count.
    """
    class Visitor(ast.NodeVisitor):
        
        def __init__(self):
            self.found = False
        
        def visit_Delete(self, node):  
            for target in node.targets:
                if isinstance(target, ast.Name):
                    self.found = True

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