code: def _deploy(self, mlops_connection, project, environment):
      if not _is_model_published(
          mlops_connection, project, self.model_id
      ):
          warnings.warn(
              "The model '%s' has not been published yet!"
              % self.model_id
          )
          return
  
      environments = _resolve_environments(
          mlops_connection, project, environment
      )
      experiment = _get_experiment(
          mlops_connection, project, self.model_id
      )
      artifact = _get_artifact(mlops_connection, experiment)
      deployments = []
      for env in environments:
          if _is_model_deployed(
              mlops_connection,
              project,
              self.model_id + "_" + env.display_name,
          ):
              warnings.warn(
                  "The model '%s' has already been deployed to %s environment."
                  % (self.model_id, env.display_name)
              )
          else:
              deployments.append(
                  (
                      _deploy_artifact(
                          mlops_connection,
                          artifact,
                          project,
                          env,
                          self.model_id,
                      ),
                      env,
                  )
              )
      for deployment, env in deployments:
          max_wait_time_secs = 300  # 5 minutes
          result = _wait_for_deployment_become_healthy(
              mlops_connection,
              deployment,
              max_wait_time_secs,
              self.model_id,
              env.display_name,
          )
          if result:
              print(
                  "Model '%s' was successfully deployed to %s environment."
                  % (self.model_id, env.display_name)
              )
              return result
          else:
              warnings.warn(
                  "Deployment of model '%s' to %s environment failed. "
                  "Go to MLOps UI to remove failed deployment with id '%s'."
                  % (self.model_id, env.display_name, deployment.id)
              )
  
imports: import h2o_cloud_extensions
  import h2o_mlops_client
  import time
  import h2o
  from .status import _is_model_deployed, _is_model_published
  from .connect import *
  from .utils import *
label_desc: Use image node_id 2 for calling a global function with example usage: _deploy(mlops_connection, project, environment) and returns: result