code: def _find_free_port():
      """
      Copied from detectron2/engine/launch.py
      """
      import socket
  
      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      # Binding to port 0 will cause the OS to find an available port for us
      sock.bind(("", 0))
      port = sock.getsockname()[1]
      sock.close()
      # NOTE: there is still a chance the port could be taken by other processes.
      return port
  
imports: import io
  import tempfile
  import unittest
  from contextlib import ExitStack
  import torch
  import torch.distributed
  import torch.multiprocessing
  from detectron2.utils import comm
  from densepose.evaluation.tensor_storage import SingleProcessFileTensorStorage, SingleProcessRamTensorStorage, SizeData, storage_gather
label_desc: Use image node_id 1 for calling a global function with example usage: _find_free_port() and returns: port