code: def train_it(frames, x):
      estimator = H2OGradientBoostingEstimator(
          distribution="bernoulli",
          ntrees=NUM_TREES,
          learn_rate=0.1,
          nfolds=0,
          score_tree_interval=20,
          stopping_rounds=3,
          stopping_tolerance=0.001,
          seed=1,
      )
      estimator.train(
          x=x,
          y="y",
          training_frame=frames[0],
          validation_frame=frames[1],
      )
  
      num_trees_trained = int(
          estimator.summary()
          .as_data_frame()["number_of_trees"]
          .to_numpy()[0]
      )
      print("num trees trained = {0}".format(num_trees_trained))
      assert (
          num_trees_trained < NUM_TREES
      ), "Early stopping is not work."
  
file_path: h2o-3/h2o-py/tests/testdir_misc/pyunit_pubdev_4697_early_stop_gbm.py
imports: import sys
  import h2o
  from tests import pyunit_utils
  import random
  from h2o.estimators.gbm import H2OGradientBoostingEstimator
  import numpy
  import pandas
  from sklearn import datasets
label_desc: Use image node_id 3 for calling a global function with example usage: train_it(frames, x) without return types