code: def _get_model_fn(self):
      def _model_fn(features, labels, mode, params):
          del labels
          del params
  
          scaffold = None
          training_hooks = None
  
          if mode == tf.estimator.ModeKeys.TRAIN:
  
              class CheckpointSaverListener(
                  tf.train.CheckpointSaverListener
              ):
                  def after_save(
                      subself, session, global_step_value
                  ):  # pylint: disable=no-self-argument
                      tf.logging.info(
                          "Creating data in %s", self._model_dir
                      )
                      with tf.gfile.Open(
                          os.path.join(self._model_dir, "data"), "w"
                      ) as f:
                          f.write("Hello")
                      assert tf.io.gfile.exists(
                          os.path.join(self._model_dir, "data")
                      )
  
              listener = CheckpointSaverListener()
              saver_hook = tf.estimator.CheckpointSaverHook(
                  self._model_dir,
                  listeners=[listener],
                  save_steps=1000000,
              )
              training_hooks = [saver_hook]
  
          else:
  
              def check_asset():
                  tf.logging.info("Checking data %s", self._model_dir)
                  assert tf.io.gfile.exists(
                      os.path.join(self._model_dir, "data")
                  )
                  return 1
  
              check_asset_op = tf.compat.v1.py_func(
                  check_asset, [], tf.int64
              )
              scaffold = tf.train.Scaffold(
                  local_init_op=tf.group(
                      tf.train.Scaffold.default_local_init_op(),
                      check_asset_op,
                  )
              )
  
          feature = next(iter(features.values()))
          with tf.control_dependencies([feature]):
              batch_size = tf.shape(feature)[0]
              predictions = tf.zeros([batch_size, 1])
              train_op = tf.no_op()
              loss = tf.constant(-1.0)
  
          return tf.estimator.EstimatorSpec(
              mode,
              loss=loss,
              train_op=train_op,
              scaffold=scaffold,
              predictions=predictions,
              training_hooks=training_hooks,
          )
  
      return _model_fn
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import contextlib
  import os
  import shutil
  import sys
  from absl import flags
  from absl import logging
  from absl.testing import parameterized
  from adanet import tf_compat
  from adanet.autoensemble.common import AutoEnsembleSubestimator
  from adanet.autoensemble.estimator import _GeneratorFromCandidatePool
  from adanet.autoensemble.estimator import AutoEnsembleEstimator
  import tensorflow.compat.v1
  from tensorflow.python.estimator.export import export
label_desc: Use image node_id 2 for calling the CheckAssetEstimator obj's underlying member method code with example usage: obj._get_model_fn() and returns: _model_fn, tf, int