code: def _test_is_shared_filesystem(strategy, tmp_path, monkeypatch):
      # Path doesn't exist
      with pytest.raises(
          FileNotFoundError,
          match="Unable to determine if the path belongs to a shared filesystem",
      ):
          is_shared_filesystem(strategy, path="not/exist")
  
      # Path exists but not the same on all ranks
      file = tmp_path / f"file-rank-{strategy.global_rank}"
      file.touch()
      folder = tmp_path / f"folder-rank-{strategy.global_rank}"
      folder.mkdir()
      assert not is_shared_filesystem(strategy, path=file)
      assert not is_shared_filesystem(strategy, path=folder)
  
      # Path exists
      folder = tmp_path / "folder"
      file = folder / "file"
      if strategy.global_rank == 0:
          folder.mkdir()
          file.touch()
      strategy.barrier()
      assert folder.exists()
      assert is_shared_filesystem(strategy, path=folder)
      assert is_shared_filesystem(strategy, path=file)
      assert os.listdir(folder) == [
          "file"
      ]  # rank test files got cleaned up
  
      # Path defaults to CWD
      monkeypatch.chdir(tmp_path)
      assert Path.cwd() == tmp_path
      assert is_shared_filesystem(strategy)
      monkeypatch.undo()
  
      # Path is a symlink
      linked = Path(tmp_path / "linked")
      if strategy.global_rank == 0:
          linked.symlink_to(
              tmp_path / "folder", target_is_directory=True
          )
      assert is_shared_filesystem(strategy, path=folder)
  
      # Remote path is considered shared
      assert is_shared_filesystem(strategy, path="s3://my-bucket/data")
  
imports: import functools
  import os
  from functools import partial
  from pathlib import Path
  from unittest import mock
  import pytest
  import torch
  from lightning.fabric.accelerators import CPUAccelerator, CUDAAccelerator, MPSAccelerator
  from lightning.fabric.plugins.environments import LightningEnvironment
  from lightning.fabric.strategies import DDPStrategy, SingleDeviceStrategy
  from lightning.fabric.strategies.launchers.multiprocessing import _MultiProcessingLauncher
  from lightning.fabric.utilities.distributed import _gather_all_tensors, _set_num_threads_if_needed, _suggested_max_num_threads, _sync_ddp, is_shared_filesystem
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 8 for calling a global function with example usage: _test_is_shared_filesystem(strategy, tmp_path, monkeypatch) without return types