code: def _make_execution_function(model, mode, class_weight=None):
      """Makes function to run one step of model execution."""
      if mode == ModeKeys.TRAIN:
          f = functools.partial(
              model.train_on_batch, class_weight=class_weight
          )
      elif mode == ModeKeys.TEST:
          f = model.test_on_batch
      else:
          # Match signature of other modes to allow
          # 1, 2, or 3-tuples from generator
          def predict_on_batch(
              x, y=None, sample_weights=None
          ):  # pylint: disable=unused-argument
              return model.predict_on_batch(x)
  
          f = predict_on_batch
  
      # Maintain stateful metrics across batch-level calls.
      if mode != ModeKeys.PREDICT:
          f = functools.partial(f, reset_metrics=False)
  
      return f
  
imports: import functools
  import math
  import numpy
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import iterator_ops
  from tensorflow.python.eager import context
  from tensorflow.python.framework import errors
  from tensorflow.python.keras import backend
  from tensorflow.python.keras import callbacks
  from tensorflow.python.keras.engine import training_utils
  from tensorflow.python.keras.engine import training_utils_v1
  from tensorflow.python.keras.utils import data_utils
  from tensorflow.python.keras.utils import generic_utils
  from tensorflow.python.keras.utils.mode_keys import ModeKeys
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.types import data
  from tensorflow.python.util import nest
label_desc: Use image node_id 6 for calling a global function with example usage: _make_execution_function(model, mode, class_weight) and returns: f, model