code: def test_listen_on_localhost(start_ray, request):
      """All ray processes should listen on localhost by default
      on mac and windows to prevent security popups.
      """
      request.getfixturevalue(start_ray)
  
      process_infos = []
      for proc in psutil.process_iter(["name", "cmdline"]):
          try:
              process_infos.append((proc, proc.name(), proc.cmdline()))
          except psutil.Error:
              pass
  
      for keyword, filter_by_cmd in RAY_PROCESSES:
          for candidate in process_infos:
              proc, proc_cmd, proc_cmdline = candidate
              corpus = (
                  proc_cmd
                  if filter_by_cmd
                  else subprocess.list2cmdline(proc_cmdline)
              )
              if keyword not in corpus:
                  continue
  
              for connection in proc.connections():
                  if connection.status != psutil.CONN_LISTEN:
                      continue
                  # ip can be 127.0.0.1 or ::127.0.0.1
                  assert "127.0.0.1" in connection.laddr.ip
  
imports: import logging
  import subprocess
  import sys
  import time
  from pathlib import Path
  import os
  import pytest
  from unittest import mock
  import ray
  import ray.cluster_utils
  from ray._private.test_utils import wait_for_condition
  from ray.autoscaler._private.constants import RAY_PROCESSES
  import psutil
label_desc: Use image node_id 5 for calling a global function with example usage: test_listen_on_localhost(start_ray, request) without return types