from __future__ import annotations from typing import Any, Mapping def guard_matches(guard: Mapping[str, Any], context: Mapping[str, Any]) -> bool: for key, expected in guard.items(): if context.get(key) != expected: return False return True