code: def start_ray_and_proxy_manager(n_ports=2):
      ray_instance = ray.init(_redis_password=REDIS_DEFAULT_PASSWORD)
      runtime_env_agent_address = (
          ray._private.worker.global_worker.node.runtime_env_agent_address
      )
      pm = proxier.ProxyManager(
          ray_instance["address"],
          session_dir=ray_instance["session_dir"],
          redis_password=REDIS_DEFAULT_PASSWORD,
          runtime_env_agent_address=runtime_env_agent_address,
      )
      free_ports = random.choices(pm._free_ports, k=n_ports)
      assert len(free_ports) == n_ports
      pm._free_ports = free_ports.copy()
  
      return pm, free_ports
  
imports: import json
  import os
  import random
  import sys
  import time
  from glob import glob
  from unittest.mock import patch, MagicMock
  from itertools import chain
  import grpc
  import pytest
  import ray
  import ray.core.generated.ray_client_pb2
  import ray.util.client.server.proxier
  from ray._private.ray_constants import REDIS_DEFAULT_PASSWORD
  from ray._private.test_utils import run_string_as_driver, wait_for_condition
  from ray.cloudpickle.compat import pickle
  from ray.job_config import JobConfig
label_desc: Use image node_id 1 for calling a global function with example usage: start_ray_and_proxy_manager(n_ports) and returns: pm,  free_ports