code: def gc_state(state):
      """Context manager to set state of garbage collector to `state`
  
      Parameters
      ----------
      state : bool
          True for gc enabled, False for disabled
  
      Examples
      --------
      >>> with gc_state(False):
      ...     assert not gc.isenabled()
      >>> with gc_state(True):
      ...     assert gc.isenabled()
      """
      orig_state = gc.isenabled()
      set_gc_state(state)
      yield
      set_gc_state(orig_state)
  
file_path: catboost/contrib/python/scipy/py2/scipy/_lib/_gcutils.py
imports: import weakref
  import gc
  import sys
  from contextlib import contextmanager
label_desc: Use image node_id 2 for calling a global function with example usage: gc_state(state) without return types