code: def wait_deployment_ready(
      deployment_name: str, namespace: str
  ) -> client.V1Deployment:
      """
      Waits until a deployment of given name is reported to be in status `Ready` by Kubernetes.
      A deployment is ready once all it's underlying pods are ready. This means there is H2O running inside each pod,
      and the clustering REST API is listening for an incoming flatfile.
  
      :param deployment_name: Name of the H2O deployment to find the correct H2O deployment
      :param namespace: Namespace the deployment belongs to.
      :return: An instance of V1Deployment, if found.
      """
      print("Waiting for H2O deployment to be ready")
      v1_apps = client.AppsV1Api()
      w = watch.Watch()
      for deployment in w.stream(
          v1_apps.list_namespaced_deployment,
          namespace,
          field_selector="metadata.name={}".format(deployment_name),
          _request_timeout=360,
      ):
          deployment = deployment["object"]
          status: client.V1DeploymentStatus = deployment.status
          if status.ready_replicas == status.replicas:
              print("H2O deployment ready")
              return deployment
  
file_path: h2o-3/h2o-k8s/tests/clustering/assisted-clustering.py
imports: import requests
  import argparse
  import sys
  import os
  import time
  from kubernetes import client, config, watch
label_desc: Use image node_id 1 for calling a global function with example usage: wait_deployment_ready(deployment_name, namespace) and returns: deployment