code: def _make_observing_model_call(
      old_call_fn: Callable[..., Any],
      key: str,
      output_dict: Dict[str, Any],
  ):
      """Returns a a function that wraps <Model>.__call__ and observes arguments.
  
      The returned function can be used to replace _DNNModel.__call__,
      _DNNModelV2.__call__, and LinearModel.__call__ so we can observe the Keras
      Model. Note that the wrapper function is "observer-only" - it wraps around the
      old_call_fn and observes its arguments.
  
      Args:
        old_call_fn: The old __call__ function.
        key: Key to write observed model to in output_dict.
        output_dict: Dictionary to write observed model to.
  
      Returns:
        A function that wraps old_call_fn and observes arguments, that can be used
        to replace DenseFeatures.__call__ and LinearModelLayer.__call__.
      """
  
      def observing_call(self, *args, **kwargs):
          output_dict[key] = self
          return old_call_fn(self, *args, **kwargs)
  
      return observing_call
  
imports: import contextlib
  import inspect
  import os
  import pickle
  from typing import Any, Callable, Dict, Optional
  import six
  import tensorflow
  from tensorflow import estimator
  import tensorflow_model_analysis
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.utils import util
  from tensorflow.python.feature_column import feature_column_v2
  from tensorflow_estimator.python.estimator.canned import dnn
label_desc: Use image node_id 2 for calling a global function with example usage: _make_observing_model_call(old_call_fn, key, output_dict) and returns: observing_call, old_call_fn