code: def build_save_model(params, x, train):
      global TMPDIR
      global MOJONAME
      # build a model
      model = H2ODeepLearningEstimator(**params)
      if params["autoencoder"]:
          model.train(x=x, training_frame=train)
      else:
          model.train(x=x, y="response", training_frame=train)
      # save model
      regex = re.compile("[+\\-* !@#$%^&()={}\\[\\]|;:'\"<>,.?/]")
      MOJONAME = regex.sub("_", model._id)
  
      print("Downloading Java prediction model code from H2O")
      TMPDIR = os.path.normpath(
          os.path.join(
              os.path.dirname(os.path.realpath("__file__")),
              "..",
              "results",
              MOJONAME,
          )
      )
      os.makedirs(TMPDIR)
      model.download_mojo(path=TMPDIR)  # save mojo
      return model
  
file_path: h2o-3/h2o-py/tests/testdir_javapredict/pyunit_pubdev_4628_pubdev_4950_deeplearning_mojo_pojo_NOPASS.py
imports: from builtins import range
  import sys, os
  import h2o
  from tests import pyunit_utils
  import random
  import re
  from h2o.estimators.deeplearning import H2ODeepLearningEstimator
label_desc: Use image node_id 4 for calling a global function with example usage: build_save_model(params, x, train) and returns: model