code: def _get_free_port(spark_host_address: str = "") -> int:
      with closing(
          socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      ) as tcp:
          tcp.bind((spark_host_address, 0))
          _, port = tcp.getsockname()
      return port
  
imports: from contextlib import closing
  import time
  import socket
  import socketserver
  from struct import pack, unpack
  import sys
  import threading
  import traceback
  from typing import Generator
  import warnings
label_desc: Use image node_id 2 for calling the LogStreamingServer obj's underlying member method code with example usage: obj._get_free_port(spark_host_address) and returns: port