code: def isolate(tmp_path_factory):
      path = tmp_path_factory.mktemp("mock")
      home_dir = path / "home"
      home_dir.mkdir()
  
      monkeypatch = pytest.MonkeyPatch()
      if sys.platform == "win32":
          home_drive, home_path = os.path.splitdrive(home_dir)
          monkeypatch.setenv("USERPROFILE", str(home_dir))
          monkeypatch.setenv("HOMEDRIVE", home_drive)
          monkeypatch.setenv("HOMEPATH", home_path)
  
          for env_var, sub_path in (
              ("APPDATA", "Roaming"),
              ("LOCALAPPDATA", "Local"),
          ):
              path = home_dir / "AppData" / sub_path
              path.mkdir(parents=True)
              monkeypatch.setenv(env_var, os.fspath(path))
      else:
          monkeypatch.setenv("HOME", str(home_dir))
  
      monkeypatch.setenv("GIT_CONFIG_NOSYSTEM", "1")
      contents = b"""
  [user]
  name=DVC Tester
  email=dvctester@example.com
  [init]
  defaultBranch=master
  """
      (home_dir / ".gitconfig").write_bytes(contents)
  
      import pygit2
  
      pygit2.settings.search_path[pygit2.GIT_CONFIG_LEVEL_GLOBAL] = str(
          home_dir
      )
  
      monkeypatch.setenv(
          env.DVC_SYSTEM_CONFIG_DIR, os.fspath(path / "system")
      )
      monkeypatch.setenv(
          env.DVC_GLOBAL_CONFIG_DIR, os.fspath(path / "global")
      )
      monkeypatch.setenv(
          env.DVC_SITE_CACHE_DIR, os.fspath(path / "site_cache_dir")
      )
  
      yield
  
      monkeypatch.undo()
  
imports: import json
  import os
  import sys
  from contextlib import suppress
  import pytest
  from dvc import env
  from dvc.stage import PipelineStage
  from dvc.testing.fixtures import *
  from .dir_helpers import *
  from .remotes import *
  from .scripts import *
label_desc: Use image node_id 11 for calling a global function with example usage: isolate(tmp_path_factory) without return types