code: def load(
      bento_identifier: str | Tag | Bento,
      working_dir: t.Optional[str] = None,
      standalone_load: bool = False,
  ) -> "Service":
      """Load a Service instance by the bento_identifier
  
      Args:
          bento_identifier: target Service to import or Bento to load
          working_dir: when importing from service, set the working_dir
          standalone_load: treat target Service as standalone. This will change global
                           current working directory and global model store.
  
      Returns:
          The loaded :obj:`bentoml.Service` instance.
  
      The argument ``bento_identifier`` can be one of the following forms:
  
      * Tag pointing to a Bento in local Bento store under `BENTOML_HOME/bentos`
      * File path to a Bento directory
      * "import_str" for loading a service instance from the `working_dir`
  
      Example load from Bento usage:
  
      .. code-block:: python
  
          # load from local bento store
          load("FraudDetector:latest")
          load("FraudDetector:4tht2icroji6zput")
  
          # load from bento directory
          load("~/bentoml/bentos/iris_classifier/4tht2icroji6zput")
  
  
      Example load from working directory by "import_str" usage:
  
      .. code-block:: python
  
          # When multiple service defined in the same module
          load("fraud_detector:svc_a")
          load("fraud_detector:svc_b")
  
          # Find svc by Python module name or file path
          load("fraud_detector:svc")
          load("fraud_detector.py:svc")
          load("foo.bar.fraud_detector:svc")
          load("./def/abc/fraud_detector.py:svc")
  
          # When there's only one Service instance in the target module, the attributes
          # part in the svc_import_path can be omitted
          load("fraud_detector.py")
          load("fraud_detector")
  
      Limitations when `standalone_load=False`:
  
          * Models used in the Service being imported, if not accessed during
            module import, must be presented in the global model store
          * Files required for the Service to run, if not accessed during module
            import, must be presented in the current working directory
      """
      if isinstance(bento_identifier, (Bento, Tag)):
          # Load from local BentoStore
          return load_bento(bento_identifier)
  
      if os.path.isdir(os.path.expanduser(bento_identifier)):
          bento_path = os.path.abspath(
              os.path.expanduser(bento_identifier)
          )
  
          if os.path.isfile(
              os.path.expanduser(
                  os.path.join(bento_path, BENTO_YAML_FILENAME)
              )
          ):
              # Loading from path to a built Bento
              try:
                  svc = load_bento_dir(
                      bento_path, standalone_load=standalone_load
                  )
              except ImportServiceError as e:
                  raise BentoMLException(
                      f"Failed loading Bento from directory {bento_path}: {e}"
                  )
              logger.info(
                  "Service loaded from Bento directory: %s", svc
              )
          elif os.path.isfile(
              os.path.expanduser(
                  os.path.join(bento_path, DEFAULT_BENTO_BUILD_FILE)
              )
          ):
              # Loading from path to a project directory containing bentofile.yaml
              try:
                  with open(
                      os.path.join(
                          bento_path, DEFAULT_BENTO_BUILD_FILE
                      ),
                      "r",
                      encoding="utf-8",
                  ) as f:
                      build_config = BentoBuildConfig.from_yaml(f)
                  assert (
                      build_config.service
                  ), '"service" field in "bentofile.yaml" is required for loading the service, e.g. "service: my_service.py:svc"'
                  BentoMLContainer.model_aliases.set(
                      build_config.model_aliases
                  )
                  svc = import_service(
                      build_config.service,
                      working_dir=bento_path,
                      standalone_load=standalone_load,
                  )
              except ImportServiceError as e:
                  raise BentoMLException(
                      f"Failed loading Bento from directory {bento_path}: {e}"
                  )
              logger.debug(
                  "'%s' loaded from '%s': %s", svc.name, bento_path, svc
              )
          else:
              raise BentoMLException(
                  f"Failed loading service from path {bento_path}. When loading from a path, it must be either a Bento containing bento.yaml or a project directory containing bentofile.yaml"
              )
      else:
          try:
              # Loading from service definition file, e.g. "my_service.py:svc"
              svc = import_service(
                  bento_identifier,
                  working_dir=working_dir,
                  standalone_load=standalone_load,
              )
              logger.debug(
                  "'%s' imported from source: %s", svc.name, svc
              )
          except ImportServiceError as e1:
              try:
                  # Loading from local bento store by tag, e.g. "iris_classifier:latest"
                  svc = load_bento(
                      bento_identifier, standalone_load=standalone_load
                  )
                  logger.debug(
                      "'%s' loaded from Bento store: %s", svc.name, svc
                  )
              except (NotFound, ImportServiceError) as e2:
                  raise BentoMLException(
                      f"Failed to load bento or import service '{bento_identifier}'.\n"
                      f"If you are attempting to import bento in local store: '{e1}'.\n"
                      f"If you are importing by python module path: '{e2}'."
                  )
      return svc
  
imports: from __future__ import annotations
  import importlib
  import logging
  import os
  import sys
  import typing
  from typing import TYPE_CHECKING
  import fs
  from simple_di import Provide
  from simple_di import inject
  from ...exceptions import BentoMLException
  from ...exceptions import ImportServiceError
  from ...exceptions import NotFound
  from ..bento import Bento
  from ..bento.bento import BENTO_PROJECT_DIR_NAME
  from ..bento.bento import BENTO_YAML_FILENAME
  from ..bento.bento import DEFAULT_BENTO_BUILD_FILE
  from ..bento.build_config import BentoBuildConfig
  from ..configuration import BENTOML_VERSION
  from ..configuration.containers import BentoMLContainer
  from ..models import ModelStore
  from ..tag import Tag
  from .service import on_load_bento
label_desc: Use image node_id 5 for calling a global function with example usage: load(bento_identifier, working_dir, standalone_load) and returns: svc, load_bento