code: def _make_port(address):
      if address[1] is None or address[1] == 0:
          ports = []
          if address[1] != 0:
              ports.append(8080)
              ports.append(8081)
              rnd = random.Random()
              for _ in range(4):
                  port = rnd.randrange(15000, 25000)
                  if port not in ports:
                      ports.append(port)
          ports.append(0)
          for port in ports:
              temp_socket = socket.socket(
                  socket.AF_INET, socket.SOCK_STREAM
              )
              temp_socket.setsockopt(
                  socket.SOL_SOCKET, socket.SO_REUSEADDR, 1
              )
              temp_socket.settimeout(1)
              try:
                  temp_socket.bind((address[0], port))
                  sockname = temp_socket.getsockname()
                  address = (address[0], sockname[1])
                  return address
              except:  # pylint: disable=bare-except
                  pass
              finally:
                  temp_socket.close()
      if isinstance(address[1], int):
          return address
      raise ValueError("Failed to allocate port.")
  
imports: import errno
  import http.server
  import importlib.util
  import json
  import os
  import random
  import re
  import socket
  import socketserver
  import sys
  import threading
  import time
  import webbrowser
  import urllib.parse
label_desc: Use image node_id 5 for calling a global function with example usage: _make_port(address) and returns: address, address