code: def _setup_session_environment(
      mp: MonkeyPatch, o: Session | Config, *pairs: tuple[str, str]
  ):
      """Setup environment variable for test session."""
      for p in pairs:
          key, value = p
          _ENV_VAR = os.environ.get(key, None)
          if _ENV_VAR is not None:
              mp.setattr(o, f"_original_{key}", _ENV_VAR, raising=False)
          os.environ[key] = value
  
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 8 for calling a global function with example usage: _setup_session_environment(mp, o) without return types