code: def test_helper(
      train_path,
      test_path,
      target,
      classification,
      blending,
      metalearner_transform,
  ):
      train = h2o.import_file(path=pu.locate(train_path))
      test = h2o.import_file(path=pu.locate(test_path))
      if classification:
          train[target] = train[target].asfactor()
      if blending:
          train, blend = train.split_frame(ratios=[0.7], seed=seed)
  
      model_args = (
          dict()
          if blending
          else dict(
              nfolds=3,
              fold_assignment="Modulo",
              keep_cross_validation_predictions=True,
          )
      )
  
      gbm = H2OGradientBoostingEstimator(
          ntrees=10, seed=seed, **model_args
      )
      gbm.train(y=target, training_frame=train)
  
      rf = H2ORandomForestEstimator(ntrees=10, seed=seed, **model_args)
      rf.train(y=target, training_frame=train)
  
      se = H2OStackedEnsembleEstimator(
          base_models=[rf, gbm],
          metalearner_transform=metalearner_transform,
      )
      se.train(
          y=target,
          training_frame=train,
          **(dict(blending_frame=blend) if blending else dict()),
      )
  
      se_predictions = se.predict(test)
  
      import tempfile
  
      tmpdir = tempfile.mkdtemp()
  
      try:
          mojo_path = se.save_mojo(tmpdir)
          mojo_model = h2o.upload_mojo(mojo_path)
      finally:
          import shutil
  
          shutil.rmtree(tmpdir)
  
      mojo_predictions = mojo_model.predict(test)
  
      assert pu.compare_frames(se_predictions, mojo_predictions, 0)
  
file_path: h2o-3/h2o-py/tests/testdir_algos/stackedensemble/pyunit_stackedensemble_mojo.py
imports: import h2o
  import sys
  from h2o.estimators.random_forest import H2ORandomForestEstimator
  from h2o.estimators.gbm import H2OGradientBoostingEstimator
  from h2o.estimators.stackedensemble import H2OStackedEnsembleEstimator
  from tests import pyunit_utils
label_desc: Use image node_id 1 for calling a global function with example usage: test_helper(train_path, test_path, target, classification, blending, metalearner_transform) without return types