code: def validate_model_builder_result(
      result, original_params, model_name
  ):
      """
      Validate that a model build result has no parameter validation errors,
      and that it has a Job with a Key.  Note that model build will return a
      Job if successful, and a ModelBuilder with errors if it's not.
      """
      global pp
      error = False
      if result is None:
          print(
              "FAIL: result for model %s is None, timeout during build? result: %s"
              % (model_name, result)
          )
          error = True
  
      elif (
          result["__http_response"]["status_code"] != requests.codes.ok
      ):
          error = True
          print(
              "FAIL: expected 200 OK from a good validation request, got: "
              + str(result["__http_response"]["status_code"])
          )
          print("dev_msg: " + result["dev_msg"])
  
      elif "error_count" in result and result["error_count"] > 0:
          # error case
          print(
              "FAIL: Parameters validation error for model: ",
              model_name,
          )
          error = True
  
      if error:
          print("Input parameters: ")
          pp.pprint(original_params)
          print("Returned result: ")
          pp.pprint(result)
          assert result["error_count"] == 0, (
              "FAIL: Non-zero error_count for model: " + model_name
          )
  
      assert "job" in result, (
          "FAIL: Failed to find job key for model: "
          + model_name
          + ": "
          + pp.pprint(result)
      )
      job = result["job"]
      assert type(job) is dict, (
          "FAIL: Job element for model is not a dict: "
          + model_name
          + ": "
          + pp.pprint(result)
      )
      assert "key" in job, (
          "FAIL: Failed to find key in job for model: "
          + model_name
          + ": "
          + pp.pprint(result)
      )
  
imports: import sys, os, time, json, datetime, errno, stat, getpass, requests, pprint
  import h2o
label_desc: Use image node_id 18 for calling a global function with example usage: validate_model_builder_result(result, original_params, model_name) without return types