code: def _supervised_signature_def(
      method_name, inputs, loss=None, predictions=None, metrics=None
  ):
      """Creates a signature for training and eval data.
  
      This function produces signatures that describe the inputs and outputs
      of a supervised process, such as training or evaluation, that
      results in loss, metrics, and the like. Note that this function only requires
      inputs to be not None.
  
      Args:
        method_name: Method name of the SignatureDef as a string.
        inputs: dict of string to `Tensor`.
        loss: dict of string to `Tensor` representing computed loss.
        predictions: dict of string to `Tensor` representing the output predictions.
        metrics: dict of string to `Tensor` representing metric ops.
  
      Returns:
        A train- or eval-flavored signature_def.
  
      Raises:
        ValueError: If inputs or outputs is `None`.
      """
      if inputs is None or not inputs:
          raise ValueError(
              f"{method_name} `inputs` cannot be None or empty."
          )
  
      signature_inputs = {
          key: utils.build_tensor_info(tensor)
          for key, tensor in inputs.items()
      }
  
      signature_outputs = {}
      for output_set in (loss, predictions, metrics):
          if output_set is not None:
              sig_out = {
                  key: utils.build_tensor_info(tensor)
                  for key, tensor in output_set.items()
              }
              signature_outputs.update(sig_out)
  
      signature_def = build_signature_def(
          signature_inputs, signature_outputs, method_name
      )
  
      return signature_def
  
imports: from tensorflow.core.framework import types_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.saved_model import signature_constants
  from tensorflow.python.saved_model import utils_impl
  from tensorflow.python.util import deprecation
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 7 for calling a global function with example usage: _supervised_signature_def(method_name, inputs, loss, predictions, metrics) and returns: signature_def