code: def save_model(
      name: Tag | str,
      pipeline: diffusers.DiffusionPipeline,
      *,
      signatures: dict[str, ModelSignatureDict | ModelSignature]
      | None = None,
      labels: dict[str, str] | None = None,
      custom_objects: dict[str, t.Any] | None = None,
      external_modules: t.List[ModuleType] | None = None,
      metadata: dict[str, t.Any] | None = None,
  ) -> bentoml.Model:
      """
      Save a DiffusionPipeline to the BentoML model store.
  
      Args:
          name:
              The name to give to the model in the BentoML store. This must be a valid
              :obj:`~bentoml.Tag` name.
          pipeline:
              Instance of the Diffusers pipeline to be saved
          signatures:
              Signatures of predict methods to be used. If not provided, the signatures
              default to {"__call__": {"batchable": False}}. See
              :obj:`~bentoml.types.ModelSignature` for more details.
          labels:
              A default set of management labels to be associated with the model. For
              example: ``{"training-set": "data-v1"}``.
          custom_objects:
              Custom objects to be saved with the model. An example is
              ``{"my-normalizer": normalizer}``. Custom objects are serialized with
              cloudpickle.
          metadata:
              Metadata to be associated with the model. An example is ``{"param_a": .2}``.
  
              Metadata is intended for display in a model management UI and therefore all
              values in metadata dictionary must be a primitive Python type, such as
              ``str`` or ``int``.
  
      Returns:
          A :obj:`~bentoml.Model` instance referencing a saved model in the local BentoML
          model store.
  
      """
  
      if not isinstance(pipeline, diffusers.DiffusionPipeline):
          raise BentoMLException(
              "'pipeline' must be an instance of 'diffusers.DiffusionPipeline'. "
          )
  
      context = ModelContext(
          framework_name="diffusers",
          framework_versions={"diffusers": diffusers.__version__},
      )
  
      if signatures is None:
          signatures = {
              "__call__": {"batchable": False},
          }
          logger.info(
              'Using the default model signature for diffusers (%s) for model "%s".',
              signatures,
              name,
          )
  
      with bentoml.models.create(
          name,
          module=MODULE_NAME,
          api_version=API_VERSION,
          signatures=signatures,
          labels=labels,
          options=None,
          custom_objects=custom_objects,
          external_modules=external_modules,
          metadata=metadata,
          context=context,
      ) as bento_model:
          diffusion_model_dir = bento_model.path_of(
              DIFFUSION_MODEL_FOLDER
          )
          pipeline.save_pretrained(diffusion_model_dir)
  
          return bento_model
  
imports: from __future__ import annotations
  import logging
  import os
  import shutil
  import typing
  from typing import TYPE_CHECKING
  import attr
  import bentoml
  from bentoml import Tag
  from bentoml.exceptions import BentoMLException
  from bentoml.exceptions import MissingDependencyException
  from bentoml.exceptions import NotFound
  from bentoml.models import ModelContext
  from ..models.model import PartialKwargsModelOptions
  from .utils.transformers import extract_commit_hash
label_desc: Use image node_id 8 for calling a global function with example usage: save_model(name, pipeline) and returns: bento_model