code: def pick_unused_port():
      """Returns an unused and unassigned local port."""
  
      if _portpicker_import_error:
          raise _portpicker_import_error  # pylint: disable=raising-bad-type
  
      global ASSIGNED_PORTS
      with lock:
          while True:
              try:
                  port = portpicker.pick_unused_port()
              except portpicker.NoFreePortFoundError:
                  raise unittest.SkipTest(
                      "Flakes in portpicker library do not represent "
                      "TensorFlow errors."
                  )
              if port > 10000 and port not in ASSIGNED_PORTS:
                  ASSIGNED_PORTS.add(port)
                  logging.info("Using local port %r", port)
                  return port
  
imports: import logging
  import tempfile
  import threading
  import unittest
  from tensorflow.python.data.experimental.service import server_lib
  from tensorflow.python.framework import errors
  from tensorflow.python.platform import test
  from tensorflow.python.profiler import profiler_client
label_desc: Use image node_id 1 for calling a global function with example usage: pick_unused_port() and returns: port