code: def operation_fn(operation, training):
      def call(*args, **kwargs):
          if (
              hasattr(operation, "_call_has_training_arg")
              and operation._call_has_training_arg
              and training is not None
          ):
              kwargs["training"] = training
          return operation(*args, **kwargs)
  
      return call
  
imports: import copy
  import inspect
  import warnings
  import tree
  from keras import backend
  from keras import ops
  from keras.backend.common import global_state
  from keras.layers.input_spec import InputSpec
  from keras.layers.layer import Layer
  from keras.legacy.saving import saving_utils
  from keras.legacy.saving import serialization
  from keras.models.model import Model
  from keras.ops.function import Function
  from keras.ops.function import make_node_key
  from keras.saving import serialization_lib
  from keras.utils import tracking
label_desc: Use image node_id 2 for calling a global function with example usage: operation_fn(operation, training) and returns: call, operation