import ast
from typing import Optional


def get_context(node: ast.AST) -> Optional[ast.AST]:
    """Returns the context or ``None`` if node has no context."""
    return getattr(node, 'wps_context', None)