code: def wait_until_internet(time_between_attempts=3, max_attempts=10):
      
      counter = 0
      while not is_internet_on():
          time.sleep(time_between_attempts)  # wait until internet is on
          counter += 1
  
          if counter > max_attempts:
              return False
  
      return True
docs: Waits until machine has internet
  
      :param time_between_attempts: seconds between 2 consecutive attempts
      :param max_attempts: max number of attempts to try
      :return: True iff there is internet connection