code: def port_is_open(port_num, hostname="127.0.0.1"):
      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      result = sock.connect_ex((hostname, port_num))
      sock.close()
      if result == 0:
          return True
      return False
  
file_path: TextAttack/textattack/loggers/visdom_logger.py
imports: import socket
  from textattack.shared.utils import LazyLoader, html_table_from_rows
  from .logger import Logger
label_desc: Use image node_id 1 for calling a global function with example usage: port_is_open(port_num, hostname) and returns: False, True