code: def select_random(ports=None, exclude_ports=None):
      
      if ports is None:
          ports = available_good_ports()
  
      if exclude_ports is None:
          exclude_ports = set()
  
      ports.difference_update(set(exclude_ports))
  
      for port in random.sample(ports, min(len(ports), 100)):
          if not port_is_used(port):
              return port
      raise PortForException("Can't select a port")
docs: Returns random unused port number.