code: def wait_for_port(port, host="localhost", timeout=5.0):
      """Wait until a port starts accepting TCP connections.
      Args:
          port (int): Port number.
          host (str): Host address on which the port should exist.
          timeout (float): In seconds. How long to wait before raising errors.
      Raises:
          TimeoutError: The port isn't accepting connection after time specified in `timeout`.
      """
      start_time = time.perf_counter()
      while True:
          try:
              with socket.create_connection(
                  (host, port), timeout=timeout
              ):
                  break
          except OSError as ex:
              time.sleep(1.0)
              if time.perf_counter() - start_time >= timeout:
                  raise TimeoutError(
                      "Waited too long for the port {} on host {} to start accepting connections.".format(
                          port, host
                      )
                  ) from ex
  
file_path: keepsake/end-to-end-test/conftest.py
imports: import socket
  import time
  import string
  import random
  import pytest
  import boto3
  from botocore.exceptions import ClientError, NoCredentialsError
  from google.cloud import storage
label_desc: Use image node_id 2 for calling a global function with example usage: wait_for_port(port, host, timeout) without return types