code: def load_kernel_config(cfg: dict) -> Callable:
      """
      Loads a kernel from a kernel config dict.
  
      Parameters
      ----------
      cfg
          A kernel config dict. (see pydantic schema's).
  
      Returns
      -------
      The kernel.
      """
      if "src" in cfg:  # Standard kernel config
          kernel = cfg.pop("src")
          if hasattr(kernel, "from_config"):
              kernel = kernel.from_config(cfg)
  
      elif "proj" in cfg:  # DeepKernel config
          # Kernel a
          kernel_a = cfg["kernel_a"]
          kernel_b = cfg["kernel_b"]
          if kernel_a != "rbf":
              cfg["kernel_a"] = load_kernel_config(kernel_a)
          if kernel_b != "rbf":
              cfg["kernel_b"] = load_kernel_config(kernel_b)
          # Assemble deep kernel
          kernel = DeepKernel.from_config(cfg)
  
      else:
          raise ValueError(
              "Unable to process kernel. The kernel config dict must either be a `KernelConfig` with a "
              "`src` field, or a `DeepkernelConfig` with a `proj` field.)"
          )
      return kernel
  
file_path: alibi-detect/alibi_detect/saving/_pytorch/loading.py
imports: import logging
  import os
  from importlib import import_module
  from pathlib import Path
  from typing import Callable, Optional, Union, Type
  import dill
  import torch
  import torch.nn
  from alibi_detect.cd.pytorch import UAE, HiddenOutput
  from alibi_detect.cd.pytorch.preprocess import _Encoder
  from alibi_detect.models.pytorch import TransformerEmbedding
  from alibi_detect.utils.pytorch.kernels import DeepKernel
label_desc: Use image node_id 3 for calling a global function with example usage: load_kernel_config(cfg) and returns: kernel