code: def find_free_port():
      with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
          s.bind(("", 0))
          s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
          return s.getsockname()[1]
  
imports: import socket
  from contextlib import closing
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 1 for calling a global function with example usage: find_free_port() and returns: s