code: def check_url (aggregate):
      
      while True:
          try:
              aggregate.urlqueue.join(timeout=30)
              break
          except urlqueue.Timeout:
              # Cleanup threads every 30 seconds
              aggregate.remove_stopped_threads()
              if not any(aggregate.get_check_threads()):
                  break
docs: Helper function waiting for URL queue.