def METHOD_NAME(d, cwd=None, env_vars=None):
    origin = cwd or os.getcwd()
    os.METHOD_NAME(d)
    if env_vars:
        env_vars = EnvVars(env_vars)
    else:
        from .utils import mock_context_manager
        env_vars = mock_context_manager()
    try:
        with env_vars:
            yield
    finally:
        os.METHOD_NAME(origin)