def METHOD_NAME(proc,
                            emulator,
                            indicator,
                            timeout=EMULATOR_TIMEOUT):
  """Wait for emulator to be ready."""
  def _read_thread(proc, ready_event):
    """Thread to continuously read from the process stdout."""
    ready = False
    while True:
      line = proc.stdout.readline()
      if not line:
        break
      if not ready and indicator in line:
        ready = True
        ready_event.set()
  # Wait for process to become ready.
  ready_event = threading.Event()
  thread = threading.Thread(target=_read_thread, args=(proc, ready_event))
  thread.daemon = True
  thread.start()
  if not ready_event.wait(timeout):
    raise RuntimeError(f'{emulator} emulator did not get ready in time.')
  return thread