code: def build_model_and_check(model, train, valid, response, ntrees):
      print()
      print("Testing: ", model.algo)
      model.train(
          y=response, training_frame=train, validation_frame=valid
      )
      print("Summary")
      print(model.get_summary())
      print("Actual params")
      print(model.actual_params)
      assert_equals(
          model.get_summary()["number_of_trees"][0],
          model.params["ntrees"]["actual"],
          "Actual parameters are not correct. Must be changed according to the model summary.",
      )
      assert_equals(
          model.get_summary()["number_of_trees"][0],
          model.actual_params["ntrees"],
          "Actual parameters are not correct. Must be changed according to the model summary.",
      )
      assert_equals(
          ntrees,
          model.params["ntrees"]["input"],
          "Input parameters are changed. Must be the same.",
      )
      assert (
          ntrees > model.actual_params["ntrees"]
      ), "Early stopping or CV is not applied, this test isn't test anything."
      print()
  
imports: import sys
  import h2o
  import os
  from tests import pyunit_utils, assert_equals
  from h2o.estimators import H2ORandomForestEstimator, H2OGradientBoostingEstimator, H2OIsolationForestEstimator, H2OXGBoostEstimator
label_desc: Use image node_id 1 for calling a global function with example usage: build_model_and_check(model, train, valid, response, ntrees) without return types