code: def is_port_available(port):
      """Check if a port is used.
  
      True if the port is available for connection.
      """
      port = int(port)
      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      available = sock.connect_ex(("localhost", port))
      sock.close()
      return available
  
file_path: PARL/parl/utils/machine_info.py
imports: import os
  import platform
  import random
  import socket
  import subprocess
  from parl.utils import logger, _HAS_FLUID, _HAS_PADDLE, _IS_WINDOWS
label_desc: Use image node_id 6 for calling a global function with example usage: is_port_available(port) and returns: available