code: def custom_distribution_mojo_test():
      rows = 2000
      df = random_dataset("binomial", verbose=False, NTESTROWS=rows)
      df["response"] = df["response"].asnumeric()
      train = df[rows:, :]
      test = df[:rows, :]
      x = list(set(df.names) - {"response"})
  
      params = {
          "ntrees": 10,
          "max_depth": 4,
          "distribution": "custom",
          "custom_distribution_func": custom_distribution_bernoulli(),
      }
      tmp_dir = tempfile.mkdtemp()
      my_gbm = build_save_model_generic(
          params, x, train, "response", "gbm", tmp_dir
      )
      mojo_name = getMojoName(my_gbm._id)
  
      h2o.download_csv(
          test[x], os.path.join(tmp_dir, "in.csv")
      )  # save test file, h2o predict/mojo use same file
      pred_h2o, pred_mojo = mojo_predict(
          my_gbm, tmp_dir, mojo_name
      )  # load model and perform predict
      assert compare_frames_local(
          pred_h2o, pred_mojo, returnResult=True
      ), "Predictions from model and MOJO model are not the same."
  
file_path: h2o-3/h2o-py/tests/testdir_algos/gbm/pyunit_PUBDEV_4076_custom_distribution_mojo.py
imports: import sys, os
  import tempfile
  import h2o
  from tests.pyunit_utils import standalone_test
  from tests.pyunit_utils import random_dataset, build_save_model_generic, getMojoName, mojo_predict
  from tests.pyunit_utils import compare_frames_local
  from h2o.utils.distributions import CustomDistributionBernoulli
label_desc: Use image node_id 2 for calling a global function with example usage: custom_distribution_mojo_test() without return types