code: def ensure_safe_environment_variables() -> (
      Generator[None, None, None]
  ):
      """
      Get a context manager to safely set environment variables
  
      All changes will be undone on close, hence environment variables set
      within this contextmanager will neither persist nor change global state.
      """
      saved_environ = dict(os.environ)
      try:
          yield
      finally:
          os.environ.clear()
          os.environ.update(saved_environ)
  
file_path: catboost/contrib/python/pandas/py3/pandas/_testing/contexts.py
imports: from __future__ import annotations
  from contextlib import contextmanager
  import os
  from pathlib import Path
  import tempfile
  from typing import IO, Any, Generator
  import uuid
  from pandas._typing import BaseBuffer, CompressionOptions, FilePath
  from pandas.compat import PYPY
  from pandas.errors import ChainedAssignmentError
  from pandas import set_option
  from pandas.io.common import get_handle
label_desc: Use image node_id 4 for calling a global function with example usage: ensure_safe_environment_variables() without return types