code: def is_hostname_valid(host: str) -> bool:
      """
      Test if a given hostname can be resolved.
      """
      try:
          socket.getaddrinfo(host, None)
          return True
      except socket.gaierror:
          return False
  
imports: import platform
  import socket
  import subprocess
label_desc: Use image node_id 2 for calling a global function with example usage: is_hostname_valid(host) and returns: True, False