def METHOD_NAME() -> Generator[Mapping[str, Any], None, None]:
    """Saves and restore environment variables.
    This is used for test that need to modify ``os.environ``
    """
    old_environ = copy.deepcopy(os.environ)
    yield old_environ
    os.environ.clear()
    os.environ.update(old_environ)