code: def test_suite_stackedensemble_levelone_frame(blending=False):
      def test_levelone_frame_not_accessible_with__keep_levelone_frame__False():
          ds = prepare_data(blending)
          models = train_base_models(ds)
          se = train_stacked_ensemble(ds, models)
          assert (
              se.levelone_frame_id() is None
          ), "Level one frame should not be available when keep_levelone_frame is False."
  
      def test_levelone_frame_accessible_with__keep_levelone_frame__True():
          ds = prepare_data(blending)
          models = train_base_models(ds)
          se = train_stacked_ensemble(
              ds, models, keep_levelone_frame=True
          )
          assert (
              se.levelone_frame_id() is not None
          ), "Level one frame should be available when keep_levelone_frame is True."
  
      def test_levelone_frame_has_expected_dimensions():
          ds = prepare_data(blending)
          models = train_base_models(ds)
          se = train_stacked_ensemble(
              ds, models, keep_levelone_frame=True
          )
          level_one_frame = h2o.get_frame(
              se.levelone_frame_id()["name"]
          )
  
          se_training_frame = ds.blend if blending else ds.train
  
          num_col_level_one_frame = (
              se_training_frame[ds.y].unique().nrow
          ) * len(
              models
          ) + 1  # count_classes(probabilities) * count_models + 1 (target)
          assert (
              level_one_frame.ncols == num_col_level_one_frame
          ), "The number of columns in a level one frame should be numClasses * numBaseModels + 1."
          assert (
              level_one_frame.nrows == se_training_frame.nrows
          ), "The number of rows in the level one frame should match train number of rows. "
  
      return [
          pu.tag_test(test, "blending" if blending else None)
          for test in [
              test_levelone_frame_not_accessible_with__keep_levelone_frame__False,
              test_levelone_frame_accessible_with__keep_levelone_frame__True,
              test_levelone_frame_has_expected_dimensions,
          ]
      ]
  
file_path: h2o-3/h2o-py/tests/testdir_algos/stackedensemble/pyunit_stackedensemble_levelone_frame.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 4 for calling a global function with example usage: test_suite_stackedensemble_levelone_frame(blending) and returns: unknown