code: def start_service(service_name, host, port):
      moto_svr_path = shutil.which("moto_server")
      args = [moto_svr_path, service_name, "-H", host, "-p", str(port)]
      process = sp.Popen(
          args, stdin=sp.PIPE, stdout=sp.DEVNULL, stderr=sp.DEVNULL
      )  # shell=True
      url = "http://{host}:{port}".format(host=host, port=port)
  
      for i in range(0, 30):
          output = process.poll()
          if output is not None:
              print("moto_server exited status {0}".format(output))
              stdout, stderr = process.communicate()
              print("moto_server stdout: {0}".format(stdout))
              print("moto_server stderr: {0}".format(stderr))
              pytest.fail(
                  "Can not start service: {}".format(service_name)
              )
  
          try:
              # we need to bypass the proxies due to monkeypatches
              requests.get(url, timeout=5, proxies=_proxy_bypass)
              break
          except requests.exceptions.ConnectionError:
              time.sleep(0.5)
      else:
          stop_process(process)  # pytest.fail doesn't call stop_process
          pytest.fail("Can not start service: {}".format(service_name))
  
      return process
  
file_path: ray/python/ray/tests/mock_s3_server.py
imports: import pytest
  import requests
  import shutil
  import signal
  import subprocess
  import time
label_desc: Use image node_id 1 for calling a global function with example usage: start_service(service_name, host, port) and returns: process