code: def _make_model_fn(ranking_model, ranking_head):
      """A helper function to make an `Estimator` model_fn.
  
      Args:
        ranking_model: A `_RankingModel` object.
        ranking_head: A `head._RankingHead` object.
  
      Returns:
        An `Estimator` `model_fn` with the following signature:
        * Args:
          `features`: The raw features from input_fn.
          `labels`: A Tensor with shape [batch_size, list_size] or a dict of Tensors
            in multi-task setting.
          `mode`: No difference.
          `params`: No difference.
          `config`: No difference..
        * Returns:
          `EstimatorSpec`.
      """
  
      def _model_fn(features, labels, mode, params, config):
          """Defines an `Estimator` `model_fn`."""
          logits = ranking_model.compute_logits(
              features, labels, mode, params, config
          )
          return ranking_head.create_estimator_spec(
              features=features, mode=mode, logits=logits, labels=labels
          )
  
      return _model_fn
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import six
  import tensorflow
  from tensorflow import estimator
  from tensorflow.python.util import function_utils
  from tensorflow_ranking.python import feature
  from tensorflow_ranking.python import utils
label_desc: Use image node_id 5 for calling a global function with example usage: _make_model_fn(ranking_model, ranking_head) and returns: _model_fn, ranking_head