code: def binomial_model(ModelType, custom_metric_func):
      (ftrain, fvalid, ftest) = dataset_prostate()
      model = ModelType(
          model_id="binomial",
          family="binomial",
          score_each_iteration=True,
          custom_metric_func=custom_metric_func,
      )
      model.train(
          y="CAPSULE",
          x=ftrain.names,
          training_frame=ftrain,
          validation_frame=fvalid,
      )
      return model, ftest
  
file_path: h2o-3/h2o-py/tests/testdir_algos/glm/pyunit_PUBDEV_6160_custom_metric.py
imports: import sys
  import h2o
  from tests import pyunit_utils
  from tests.pyunit_utils import CustomMaeFunc, CustomRmseFunc, CustomLoglossFunc, dataset_prostate, dataset_iris
  from h2o.estimators.glm import H2OGeneralizedLinearEstimator
label_desc: Use image node_id 2 for calling a global function with example usage: binomial_model(ModelType, custom_metric_func) and returns: model,  ftest