code: def resolve_pipeline_class(
      pipeline_str: str,
      pipeline_mapping: dict[str, type[diffusers.DiffusionPipeline]]
      | None = None,
  ) -> type[diffusers.DiffusionPipeline]:
      try:
          pipeline_class = _str2cls(pipeline_str)
      except AttributeError:
          try:
              if pipeline_mapping:
                  pipeline_class = pipeline_mapping[
                      pipeline_str.lower()
                  ]
              else:
                  raise KeyError
          except KeyError:
              raise BentoMLException(
                  f"Cannot resolve pipeline {pipeline_str}"
              )
  
      return pipeline_class
  
file_path: BentoML/src/bentoml/_internal/frameworks/diffusers_runners/utils.py
imports: from __future__ import annotations
  import logging
  import diffusers
  import inflection
  from huggingface_hub import model_info
  import bentoml
  from bentoml import Tag
  from bentoml._internal.frameworks.diffusers import _str2cls
  from bentoml._internal.frameworks.diffusers import import_model
  from bentoml.exceptions import BentoMLException
  from bentoml.exceptions import NotFound
label_desc: Use image node_id 3 for calling a global function with example usage: resolve_pipeline_class(pipeline_str, pipeline_mapping) and returns: pipeline_class