code: def infer_family_helper(
      family,
      expected_family,
      link,
      expected_link,
      kwargs1=None,
      kwargs2=None,
  ):
      kwargs1 = dict() if kwargs1 is None else kwargs1
      kwargs2 = dict() if kwargs2 is None else kwargs2
      train = h2o.import_file(
          pyunit_utils.locate("smalldata/iris/iris_train.csv")
      )
      test = h2o.import_file(
          pyunit_utils.locate("smalldata/iris/iris_test.csv")
      )
      if family == "multinomial":
          y = "species"
      elif family == "binomial":
          train["response"] = (
              train["species"] == "Iris-versicolor"
          ).asfactor()
          test["response"] = (
              test["species"] == "Iris-versicolor"
          ).asfactor()
          y = "response"
      elif family == "quasibinomial" or family == "fractionalbinomial":
          train["response"] = (
              train["species"] == "Iris-versicolor"
          ) / 2
          test["response"] = (test["species"] == "Iris-versicolor") / 2
          y = "response"
      elif family == "ordinal":
          y = "response"
          train[y] = train["species"] == "Iris-versicolor"
          test[y] = test["species"] == "Iris-versicolor"
          train[(train["species"] == "Iris-setosa"), y] = 2
          test[(test["species"] == "Iris-setosa"), y] = 2
          train[y] = train[y].asfactor()
          test[y] = test[y].asfactor()
      else:
          y = "petal_wid"
  
      x = train.columns
      x.remove(y)
  
      if "link" not in kwargs1 and link:
          kwargs1["link"] = link
      if "family" not in kwargs1:
          kwargs1["family"] = family
  
      if "link" not in kwargs2 and link:
          kwargs2["link"] = link
      if "family" not in kwargs2:
          kwargs2["family"] = family
  
      nfolds = 2
      glm = H2OGeneralizedLinearEstimator(
          nfolds=nfolds,
          fold_assignment="Modulo",
          keep_cross_validation_predictions=True,
          **kwargs1,
      )
      glm.train(x=x, y=y, training_frame=train)
  
      glm2 = H2OGeneralizedLinearEstimator(
          nfolds=nfolds,
          fold_assignment="Modulo",
          keep_cross_validation_predictions=True,
          **kwargs2,
      )
      glm2.train(x=x, y=y, training_frame=train)
  
      se = H2OStackedEnsembleEstimator(
          training_frame=train,
          validation_frame=test,
          base_models=[glm, glm2],
          metalearner_algorithm="glm",
      )
      se.train(x, y, train)
      assert (
          se.metalearner().actual_params.get("family")
          == expected_family
      ), "Expected family {} but got {}".format(
          expected_family, se.metalearner().actual_params.get("family")
      )
      if link:
          assert (
              se.metalearner().actual_params.get("link")
              == expected_link
          ), "Expected link {} but got {}".format(
              expected_link, se.metalearner().actual_params.get("link")
          )
  
      se_auto = H2OStackedEnsembleEstimator(
          training_frame=train,
          validation_frame=test,
          base_models=[glm, glm2],
          metalearner_algorithm="auto",
      )
      se_auto.train(x, y, train)
      assert (
          se_auto.metalearner().actual_params.get("family")
          == expected_family
      ), "Expected family {} but got {}".format(
          expected_family,
          se_auto.metalearner().actual_params.get("family"),
      )
      if link:
          assert (
              se_auto.metalearner().actual_params.get("link")
              == expected_link
          ), "Expected link {} but got {}".format(
              expected_link,
              se_auto.metalearner().actual_params.get("link"),
          )
  
file_path: h2o-3/h2o-py/tests/testdir_algos/stackedensemble/pyunit_stackedensemble_distributions.py
imports: import sys
  import h2o
  from h2o.estimators.random_forest import H2ORandomForestEstimator
  from h2o.estimators.glm import H2OGeneralizedLinearEstimator
  from h2o.estimators.gbm import H2OGradientBoostingEstimator
  from h2o.estimators.stackedensemble import H2OStackedEnsembleEstimator
  from h2o.estimators.naive_bayes import H2ONaiveBayesEstimator
  from tests import pyunit_utils
label_desc: Use image node_id 3 for calling a global function with example usage: infer_family_helper(family, expected_family, link, expected_link, kwargs1, kwargs2) without return types