code: def _load_learner_from_disk(
      learner_type: Union[
          Type["skll.learner.Learner"],
          Type["skll.learner.voting.VotingLearner"],
      ],
      filepath: PathOrStr,
      logger: logging.Logger,
  ) -> Union[
      "skll.learner.Learner", "skll.learner.voting.VotingLearner"
  ]:
      """
      Load a saved instance of the given type from disk.
  
      NOTE: This function should only be used by the ``from_file()``
      methods for the various learner classes in SKLL.
  
      Parameters
      ----------
      learner_type : Union[Type[:class:`skll.learner.Learner`], Type[:class:`skll.learner.voting.VotingLearner`]]
          The type of learner instance to load from disk.
      filepath : :class:`skll.types.PathOrStr`
          The path to a saved ``Learner`` or ``VotingLearner`` file.
      logger : logging.Logger
          A logging object.
  
      Returns
      -------
      learner : Union[:class:`skll.learner.Learner`, :class:`skll.learner.voting.VotingLearner`]
          The ``Learner`` or ``VotingLearner`` instance loaded from the file.
  
      Raises
      ------
      ValueError
          If the pickled version of the ``Learner`` instance is out of date.
      """
      skll_version, learner = joblib.load(filepath)
  
      # Check that we've actually loaded an instance of the requested type
      if not isinstance(learner, learner_type):
          raise ValueError(
              f"'{filepath}' does not contain an object "
              f"of type '{learner_type.__name__}'."
          )
  
      # check that versions are compatible
      elif skll_version < (2, 5, 0):
          model_version_str = ".".join(map(str, skll_version))
          current_version_str = ".".join(map(str, VERSION))
          raise ValueError(
              f"The learner stored in '{filepath}' was "
              f"created with v{model_version_str} of SKLL, "
              "which is incompatible with the current "
              f"v{current_version_str}."
          )
      else:
          if not hasattr(learner, "sampler"):
              learner.sampler = None
  
          # For backward compatibility, convert string model types to actual classes
          if isinstance(learner._model_type, str):
              learner._model_type = globals()[learner._model_type]
  
          # set the learner logger attribute to the logger that's passed in
          learner.logger = logger
  
          # if the loaded learner is a `VotingLearner` then we need to attach
          # the same logger to the underlying learners as well
          if learner_type.__name__ == "VotingLearner":
              for underlying_learner in learner._learners:
                  underlying_learner.logger = logger
  
          return learner
  
imports: from __future__ import annotations
  import inspect
  import logging
  import sys
  import time
  from collections import Counter, defaultdict
  from csv import DictWriter, excel_tab
  from functools import wraps
  from importlib import import_module
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Set, Tuple, Type, Union
  import joblib
  import numpy
  import scipy.sparse
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.feature_selection import SelectKBest
  from sklearn.metrics import accuracy_score, confusion_matrix, precision_recall_fscore_support
  from sklearn.model_selection import KFold, LeaveOneGroupOut, ShuffleSplit, StratifiedKFold
  from skll.data import FeatureSet
  from skll.metrics import _CUSTOM_METRICS, _PREDEFINED_CUSTOM_METRICS, use_score_func
  from skll.types import ComputeEvalMetricsResults, ConfusionMatrix, FeaturesetIterator, FoldMapping, IdType, IndexIterator, LabelType, PathOrStr, SparseFeatureMatrix
  from skll.utils.constants import CLASSIFICATION_ONLY_METRICS, CORRELATION_METRICS, REGRESSION_ONLY_METRICS, UNWEIGHTED_KAPPA_METRICS, WEIGHTED_KAPPA_METRICS
  from skll.version import VERSION
label_desc: Use image node_id 15 for calling a global function with example usage: _load_learner_from_disk(learner_type, filepath, logger) and returns: learner