from typing import Dict
from typing import Any


def _enforce_str_keys(data: Dict[str, Any]) -> Dict[str, Any]:
    """Changes keys in nested dicts to strings."""
    if isinstance(data, dict):
        return {str(key): _enforce_str_keys(value) for key, value in data.items()}
    return data