code: def temp_nilearn_data_dir(tmp_path_factory, monkeypatch):
      """Monkeypatch user home directory and NILEARN_DATA env variable.
  
      This ensures that tests that use nilearn.datasets will not load datasets
      already present on the current machine, or write in the user's home or
      nilearn data directory.
  
      This fixture uses 'autouse' and is imported in conftest.py to make sure it
      is used by every test, even those that do not explicitly ask for it.
  
      """
      home_dir = tmp_path_factory.mktemp("temp_nilearn_home")
      monkeypatch.setenv("HOME", str(home_dir))
      monkeypatch.setenv("USERPROFILE", str(home_dir))
      data_dir = home_dir / "nilearn_data"
      data_dir.mkdir()
      monkeypatch.setenv("NILEARN_DATA", str(data_dir))
      shared_data_dir = home_dir / "nilearn_shared_data"
      monkeypatch.setenv("NILEARN_SHARED_DATA", str(shared_data_dir))
  
imports: import fnmatch
  import json
  import os
  import pickle
  import re
  import shutil
  import tempfile
  from collections import OrderedDict
  from pathlib import Path
  from unittest.mock import MagicMock
  import pytest
  from requests.exceptions import HTTPError
  from nilearn._utils.testing import serialize_niimg
label_desc: Use image node_id 1 for calling a global function with example usage: temp_nilearn_data_dir(tmp_path_factory, monkeypatch) without return types