code: def no_internet(verbose=False):
      """Context manager to temporarily disable internet access (if not already
      disabled).  If it was already disabled before entering the context manager
      (i.e. `turn_off_internet` was called previously) then this is a no-op and
      leaves internet access disabled until a manual call to `turn_on_internet`.
      """
  
      already_disabled = INTERNET_OFF
  
      turn_off_internet(verbose=verbose)
      try:
          yield
      finally:
          if not already_disabled:
              turn_on_internet(verbose=verbose)
  
file_path: catboost/contrib/python/matplotlib/py2/matplotlib/testing/disable_internet.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import contextlib
  import socket
  from six.moves import urllib
label_desc: Use image node_id 4 for calling a global function with example usage: no_internet(verbose) without return types