code: def get_loss(identifier, y_true, y_pred):
      if identifier is None:
          return None  # Ok to have no loss for an output.
  
      # Convenience feature for selecting b/t binary, categorical,
      # and sparse categorical.
      if str(identifier).lower() not in ["crossentropy", "ce"]:
          loss_obj = losses_module.get(identifier)
      else:
          (
              is_binary,
              is_sparse_categorical,
          ) = is_binary_or_sparse_categorical(y_true, y_pred)
          if is_binary:
              loss_obj = losses_module.binary_crossentropy
          elif is_sparse_categorical:
              loss_obj = losses_module.sparse_categorical_crossentropy
          else:
              loss_obj = losses_module.categorical_crossentropy
  
      if not isinstance(loss_obj, losses_module.Loss):
          if isinstance(identifier, str):
              loss_name = identifier
          else:
              loss_name = get_object_name(loss_obj)
          loss_obj = losses_module.LossFunctionWrapper(
              loss_obj, name=loss_name
          )
      return loss_obj
  
imports: import tree
  from keras import backend
  from keras import losses
  from keras import metrics
  from keras import ops
  from keras.utils.naming import get_object_name
label_desc: Use image node_id 4 for calling a global function with example usage: get_loss(identifier, y_true, y_pred) and returns: loss_obj, None