docs: def restore_gc_state():
      """
      Restore the garbage collector state on leaving the with block.
  
      """
      old_isenabled = gc.isenabled()
      old_flags = gc.get_debug()
      try:
          yield
      finally:
          gc.set_debug(old_flags)
          (gc.enable if old_isenabled else gc.disable)()