code: def get_available_port(ip):
      """Get available port with specified ip."""
      import socket
  
      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      for port in range(1234, 65535):
          try:
              sock.connect((ip, port))
          except:
              return port
      raise RuntimeError(
          "Failed to get available port for ip~{}".format(ip)
      )
  
imports: import argparse
  import json
  import logging
  import multiprocessing
  import os
  import queue
  import re
  import signal
  import subprocess
  import sys
  import time
  from functools import partial
  from threading import Thread
  from typing import Optional
label_desc: Use image node_id 13 for calling a global function with example usage: get_available_port(ip) and returns: port