def turn_on_internet(verbose=False):
 global INTERNET_OFF
 global _orig_opener
 if (not INTERNET_OFF):
  return
 INTERNET_OFF = False
 if verbose:
  print(u'Internet access enabled')
 urllib.request.install_opener(_orig_opener)
 socket.create_connection = socket_create_connection
 socket.socket.bind = socket_bind
 socket.socket.connect = socket_connect
 return socket

def turn_on_internet ( verbose = False ) : global INTERNET_OFF global _orig_opener if ( not INTERNET_OFF ) : return INTERNET_OFF = False if verbose : print ( u'Internet access enabled' ) urllib . request . install_opener ( _orig_opener ) socket . create_connection = socket_create_connection socket . socket . bind = socket_bind socket . socket . connect = socket_connect return socket
restore internet access .