def METHOD_NAME(
        node: ast.AST,
        from_imports: dict[str, set[str]],
) -> tuple[Offset, str] | None:
    if isinstance(node, ast.Name) and node.id in ERROR_NAMES:
        return ast_to_offset(node), node.id
    elif (
            isinstance(node, ast.Name) and
            node.id == 'error' and
            any(node.id in from_imports[mod] for mod in ERROR_MODULES)
    ):
        return ast_to_offset(node), node.id
    elif (
            isinstance(node, ast.Attribute) and
            isinstance(node.value, ast.Name) and
            node.value.id in ERROR_MODULES and
            node.attr == 'error'
    ):
        return ast_to_offset(node), node.attr
    else:
        return None