from typing import Any, Dict, Iterable def is_valid(settings: Dict[str, Any], types: Iterable[str]) -> bool: return not types or not settings or set(types) == set(settings.keys())