code: def serialize(
      model,
      callbacks=None,
      datasets=None,
      dump_weights=True,
      keep_states=True,
  ):
      """
      Serialize the model, callbacks and datasets.
  
      Arguments:
          model (Model): Model object
          callbacks (Callbacks, optional): Callbacks
          datasets (iterable, optional): Datasets
          dump_weights (bool, optional): Ignored
          keep_states (bool, optional): Whether to save optimizer states too.
  
      Returns:
          dict: Model data, callbacks and datasets
  
      """
      pdict = model.serialize(fn=None, keep_states=keep_states)
      if callbacks is not None:
          pdict["callbacks"] = callbacks.serialize()
  
      if datasets is not None:
          pdict["datasets"] = datasets.serialize()
  
      return pdict
  
file_path: neon/neon/util/persist.py
imports: import importlib
  import logging
  import os
  import pkgutil
  import sys
  import appdirs
  from neon.util.compat import pickle, pickle_load
label_desc: Use image node_id 8 for calling a global function with example usage: serialize(model, callbacks, datasets, dump_weights, keep_states) and returns: pdict