code: def get_device_stats() -> Dict[str, float]:
      if not _PSUTIL_AVAILABLE:
          raise ModuleNotFoundError(
              f"Fetching MPS device stats requires `psutil` to be installed. {str(_PSUTIL_AVAILABLE)}"
          )
      import psutil
  
      return {
          _VM_PERCENT: psutil.virtual_memory().percent,
          _PERCENT: psutil.cpu_percent(),
          _SWAP_PERCENT: psutil.swap_memory().percent,
      }
  
imports: from typing import Any, Dict, List, Optional, Union
  import torch
  from typing_extensions import override
  from lightning.fabric.accelerators import _AcceleratorRegistry
  from lightning.fabric.accelerators.mps import MPSAccelerator
  from lightning.fabric.utilities.device_parser import _parse_gpu_ids
  from lightning.fabric.utilities.types import _DEVICE
  from lightning.pytorch.accelerators.accelerator import Accelerator
  from lightning.pytorch.accelerators.cpu import _PSUTIL_AVAILABLE
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
label_desc: Use image node_id 1 for calling a global function with example usage: get_device_stats() and returns: dict