code: def _setup_deployment_mode(metafunc: Metafunc):
      """
      Setup deployment mode for test session.
      We will dynamically add this fixture to tests functions that has ``deployment_mode`` fixtures.
  
      Current matrix:
      - deployment_mode: ["container", "distributed", "standalone"]
      """
      if os.getenv("VSCODE_IPC_HOOK_CLI") and not os.getenv(
          "GITHUB_CODESPACE_TOKEN"
      ):
          # When running inside VSCode remote container locally, we don't have access to
          # exposed reserved ports, so we can't run container-based tests. However on GitHub
          # Codespaces, we can run container-based tests.
          # Note that inside the remote container, it is already running as a Linux container.
          deployment_mode = ["distributed", "standalone"]
      else:
          if os.environ.get("GITHUB_ACTIONS") and (
              psutil.WINDOWS or psutil.MACOS
          ):
              # Due to GitHub Actions' limitation, we can't run container-based tests
              # on Windows and macOS. However, we can still running those tests on
              # local development.
              if psutil.MACOS:
                  deployment_mode = ["distributed", "standalone"]
              else:
                  deployment_mode = ["standalone"]
          else:
              if psutil.WINDOWS:
                  deployment_mode = ["standalone", "container"]
              else:
                  deployment_mode = [
                      "distributed",
                      "standalone",
                      "container",
                  ]
      metafunc.parametrize(
          "deployment_mode", deployment_mode, scope="session"
      )
  
imports: from __future__ import annotations
  import contextlib
  import os
  import tempfile
  import typing
  from typing import TYPE_CHECKING
  import psutil
  import pytest
  from pytest import MonkeyPatch
  import bentoml
  from bentoml._internal.configuration import BENTOML_VERSION
  from bentoml._internal.configuration import clean_bentoml_version
  from bentoml._internal.configuration.containers import BentoMLContainer
  from bentoml._internal.models import ModelContext
  from bentoml._internal.utils import LazyLoader
  from bentoml._internal.utils import validate_or_create_dir
label_desc: Use image node_id 5 for calling a global function with example usage: _setup_deployment_mode(metafunc) without return types