code: def load_model(
      bento_model: str | Tag | bentoml.Model,
  ) -> xgb.Booster | xgb.XGBModel:
      """
      Load the XGBoost model with the given tag from the local BentoML model store.
  
      Args:
          bento_model (``str`` ``|`` :obj:`~bentoml.Tag` ``|`` :obj:`~bentoml.Model`):
              Either the tag of the model to get from the store, or a BentoML `~bentoml.Model`
              instance to load the model from.
      Returns:
          The XGBoost model loaded from the model store or BentoML :obj:`~bentoml.Model`.
      Example:
  
      .. code-block:: python
  
          import bentoml
          # target model must be from the BentoML model store
          booster = bentoml.xgboost.load_model("my_xgboost_model")
      """  # noqa: LN001
      if not isinstance(bento_model, bentoml.Model):
          bento_model = get(bento_model)
          assert isinstance(bento_model, bentoml.Model)
  
      if bento_model.info.module not in (MODULE_NAME, __name__):
          raise NotFound(
              f"Model {bento_model.tag} was saved with module {bento_model.info.module}, not loading with {MODULE_NAME}."
          )
  
      model_file = bento_model.path_of(MODEL_FILENAME)
      model_api_version = bento_model.info.api_version
      if model_api_version == "v1":
          model = xgb.Booster(model_file=model_file)
      else:
          if model_api_version != "v2":
              logger.warning(
                  "Got an XGBoost model with an unsupported version '%s', unexpected errors may occur.",
                  model_api_version,
              )
          model_class = t.cast(
              XGBoostOptions, bento_model.info.options
          ).model_class
          if model_class is None:
              raise BentoMLException(
                  f"Model '{bento_model.tag}' is missing the required 'model_class' option. This should not be possible; please file an issue if you encounter this error."
              )
          try:
              xgb_class: type[xgb.XGBModel] | type[
                  xgb.Booster
              ] = getattr(xgb, model_class)
          except AttributeError:
              if model_class != "Booster":
                  raise BentoMLException(
                      f"Model '{bento_model.tag}' is an XGBoost Scikit-Learn model, but sklearn is not installed."
                  ) from None
              else:
                  raise BentoMLException(
                      "xgboost.Booster could not be found, your XGBoost installation may be corrupted. Ensure there is no file named 'xgboost.py' that may be being loaded instead of the XGBoost library."
                  ) from None
          model: xgb.Booster | xgb.XGBModel = xgb_class()
          model.load_model(model_file)
      return model
  
imports: from __future__ import annotations
  import logging
  import os
  import typing
  from types import ModuleType
  from typing import TYPE_CHECKING
  import attr
  import numpy
  import bentoml
  from bentoml import Tag
  from bentoml.exceptions import BentoMLException
  from bentoml.exceptions import InvalidArgument
  from bentoml.exceptions import MissingDependencyException
  from bentoml.exceptions import NotFound
  from bentoml.models import ModelOptions
  from ..models.model import ModelContext
  from ..utils.pkg import get_pkg_version
label_desc: Use image node_id 2 for calling a global function with example usage: load_model(bento_model) and returns: model