code: def serialize_loss(loss):
      if isinstance(loss, str):
          return [loss]
      return keras.losses.serialize(loss)
  
file_path: autokeras/autokeras/engine/head.py
imports: from typing import Optional
  from tensorflow import keras
  from autokeras.engine import io_hypermodel
  from autokeras.utils import types
label_desc: Use image node_id 3 for calling a global function with example usage: serialize_loss(loss) and returns: keras, list