code: def _get_pipeline_class(
      class_obj,
      config,
      load_connected_pipeline=False,
      custom_pipeline=None,
      repo_id=None,
      hub_revision=None,
      class_name=None,
      cache_dir=None,
      revision=None,
  ):
      if custom_pipeline is not None:
          if custom_pipeline.endswith(".py"):
              path = Path(custom_pipeline)
              # decompose into folder & file
              file_name = path.name
              custom_pipeline = path.parent.absolute()
          elif repo_id is not None:
              file_name = f"{custom_pipeline}.py"
              custom_pipeline = repo_id
          else:
              file_name = CUSTOM_PIPELINE_FILE_NAME
  
          if repo_id is not None and hub_revision is not None:
              # if we load the pipeline code from the Hub
              # make sure to overwrite the `revison`
              revision = hub_revision
  
          return get_class_from_dynamic_module(
              custom_pipeline,
              module_file=file_name,
              class_name=class_name,
              cache_dir=cache_dir,
              revision=revision,
          )
  
      if class_obj != DiffusionPipeline:
          return class_obj
  
      diffusers_module = importlib.import_module(
          class_obj.__module__.split(".")[0]
      )
      class_name = config["_class_name"]
      class_name = (
          class_name[4:]
          if class_name.startswith("Flax")
          else class_name
      )
  
      pipeline_cls = getattr(diffusers_module, class_name)
  
      if load_connected_pipeline:
          from .auto_pipeline import _get_connected_pipeline
  
          connected_pipeline_cls = _get_connected_pipeline(pipeline_cls)
          if connected_pipeline_cls is not None:
              logger.info(
                  f"Loading connected pipeline {connected_pipeline_cls.__name__} instead of {pipeline_cls.__name__} as specified via `load_connected_pipeline=True`"
              )
          else:
              logger.info(
                  f"{pipeline_cls.__name__} has no connected pipeline class. Loading {pipeline_cls.__name__}."
              )
  
          pipeline_cls = connected_pipeline_cls or pipeline_cls
  
      return pipeline_cls
  
imports: import fnmatch
  import importlib
  import inspect
  import os
  import re
  import sys
  import warnings
  from dataclasses import dataclass
  from pathlib import Path
  from typing import Any, Callable, Dict, List, Optional, Union
  import numpy
  import PIL.Image
  import requests
  import torch
  from huggingface_hub import ModelCard, create_repo, hf_hub_download, model_info, snapshot_download
  from huggingface_hub.utils import OfflineModeIsEnabled, validate_hf_hub_args
  from packaging import version
  from requests.exceptions import HTTPError
  from tqdm.auto import tqdm
  from ..None import __version__
  from ..configuration_utils import ConfigMixin
  from ..models.modeling_utils import _LOW_CPU_MEM_USAGE_DEFAULT
  from ..schedulers.scheduling_utils import SCHEDULER_CONFIG_NAME
  from ..utils import CONFIG_NAME, DEPRECATED_REVISION_ARGS, SAFETENSORS_WEIGHTS_NAME, WEIGHTS_NAME, BaseOutput, deprecate, get_class_from_dynamic_module, is_accelerate_available, is_accelerate_version, is_peft_available, is_torch_version, is_transformers_available, logging, numpy_to_pil
  from ..utils.torch_utils import is_compiled_module
  from ..utils import FLAX_WEIGHTS_NAME, ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, PushToHubMixin
label_desc: Use image node_id 7 for calling a global function with example usage: _get_pipeline_class(class_obj, config, load_connected_pipeline, custom_pipeline, repo_id, hub_revision, class_name, cache_dir, revision) and returns: pipeline_cls, get_class_from_dynamic_module, class_obj