class_docstr: .. note:: tested on etcd server v3.4.3.
  
  Starts and stops a local standalone etcd server on a random free
  port. Useful for single node, multi-worker launches or testing,
  where a sidecar etcd server is more convenient than having to
  separately setup an etcd server.
  
  This class registers a termination handler to shutdown the etcd
  subprocess on exit. This termination handler is NOT a substitute for
  calling the ``stop()`` method.
  
  The following fallback mechanism is used to find the etcd binary:
  
  1. Uses env var TORCHELASTIC_ETCD_BINARY_PATH
  2. Uses ``<this file root>/bin/etcd`` if one exists
  3. Uses ``etcd`` from ``PATH``
  
  Usage
  ::
  
   server = EtcdServer("/usr/bin/etcd", 2379, "/tmp/default.etcd")
   server.start()
   client = server.get_client()
   # use client
   server.stop()
  
  Args:
      etcd_binary_path: path of etcd server binary (see above for fallback path)
code: def _wait_for_ready(self, timeout: int = 60) -> None:
      client = etcd.Client(
          host=f"{self._host}",
          port=self._port,
          version_prefix="/v2",
          read_timeout=5,
      )
      max_time = time.time() + timeout
  
      while time.time() < max_time:
          if self._get_etcd_server_process().poll() is not None:
              # etcd server process finished
              exitcode = self._get_etcd_server_process().returncode
              raise RuntimeError(
                  f"Etcd server process exited with the code: {exitcode}"
              )
          try:
              log.info("etcd server ready. version: %s", client.version)
              return
          except Exception:
              time.sleep(1)
      raise TimeoutError(
          "Timed out waiting for etcd server to be ready!"
      )
  
imports: import atexit
  import logging
  import os
  import shlex
  import shutil
  import socket
  import subprocess
  import tempfile
  import time
  from typing import Optional, TextIO, Union
label_desc: Use image node_id 9 for calling the EtcdServer obj's underlying member method code with example usage: obj._wait_for_ready(timeout) without return types