import ast


def is_scope(node):
    """True if the ast node is a scope else False."""
    if not isinstance(node, ast.AST):

        raise TypeError("The input must be an AST node.")

    return (
        isinstance(node, ast.Module) or
        isinstance(node, ast.FunctionDef) or
        isinstance(node, ast.ClassDef)
    )