code: def save_model(
      name: Tag | str,
      model: ModelType,
      *,
      signatures: dict[str, ModelSignature] | None = None,
      labels: t.Dict[str, str] | None = None,
      custom_objects: t.Dict[str, t.Any] | None = None,
      external_modules: t.List[ModuleType] | None = None,
      metadata: t.Dict[str, t.Any] | None = None,
  ) -> bentoml.Model:
      """
      Save a model instance to BentoML modelstore.
  
      Args:
          name: Name for given model instance. This should pass Python identifier check.
          model: Instance of model to be saved.
          signatures: Methods to expose for running inference on the target model. Signatures are
                      used for creating Runner instances when serving model with bentoml.Service
          labels: user-defined labels for managing models, e.g. team=nlp, stage=dev
          custom_objects: user-defined additional python objects to be saved alongside the model,
                          e.g. a tokenizer instance, preprocessor function, model configuration json
          external_modules: user-defined additional python modules to be saved alongside the model or custom objects,
                            e.g. a tokenizer module, preprocessor module, model configuration module
          metadata: Custom metadata for given model.
  
      Returns:
          :obj:`~bentoml.Tag`: A :obj:`tag` with a format ``name:version`` where ``name`` is
          the user-defined model's name, and a generated ``version``.
  
      Examples:
  
      .. code-block:: python
  
          import bentoml
  
          bento_model = bentoml.picklable.save_model('picklable_pyobj', model)
      """  # noqa
      context = ModelContext(
          framework_name="cloudpickle",
          framework_versions={"cloudpickle": cloudpickle.__version__},
      )
  
      if signatures is None:
          signatures = {"__call__": ModelSignature(batchable=False)}
          logger.info(
              'Using the default model signature for pickable model (%s) for model "%s".',
              signatures,
              name,
          )
  
      with bentoml.models.create(
          name,
          module=MODULE_NAME,
          api_version=API_VERSION,
          labels=labels,
          custom_objects=custom_objects,
          external_modules=external_modules,
          metadata=metadata,
          context=context,
          signatures=signatures,
          options=ModelOptions(),
      ) as bento_model:
          with open(
              bento_model.path_of(f"{SAVE_NAMESPACE}{PKL_EXT}"), "wb"
          ) as f:
              cloudpickle.dump(model, f)
  
          return bento_model
  
file_path: BentoML/grpc-client/bentoml/_internal/frameworks/picklable.py
imports: from __future__ import annotations
  import logging
  import typing
  from types import ModuleType
  from typing import TYPE_CHECKING
  import cloudpickle
  import bentoml
  from bentoml import Tag
  from bentoml.exceptions import NotFound
  from bentoml.models import Model
  from bentoml.models import ModelContext
  from ..models import PKL_EXT
  from ..models import SAVE_NAMESPACE
  from ..models.model import ModelSignature
  from ..models.model import PartialKwargsModelOptions
label_desc: Use image node_id 3 for calling a global function with example usage: save_model(name, model) and returns: bento_model