code: def test_connection(name, url, timeout=10):
      """Simple connection test"""
      urlinfo = urlparse(url)
      start = time.time()
      try:
          ip = socket.gethostbyname(urlinfo.netloc)
      except Exception as e:
          print(
              "Error resolving DNS for {}: {}, {}".format(name, url, e)
          )
          return
      dns_elapsed = time.time() - start
      start = time.time()
      try:
          _ = urlopen(url, timeout=timeout)
      except Exception as e:
          print(
              "Error open {}: {}, {}, DNS finished in {} sec.".format(
                  name, url, e, dns_elapsed
              )
          )
          return
      load_elapsed = time.time() - start
      print(
          "Timing for {}: {}, DNS: {:.4f} sec, LOAD: {:.4f} sec.".format(
              name, url, dns_elapsed, load_elapsed
          )
      )
  
file_path: gluon-nlp/tools/diagnose.py
imports: import platform, subprocess, sys, os
  import socket, time
  import argparse
label_desc: Use image node_id 2 for calling a global function with example usage: test_connection(name, url, timeout) without return types