code: def get_psutil_cpu_stats() -> CPUStats:
      """Get CPU process stats using psutil.
  
      Returns:
          Dict[str, float]: a dict that maps cpu stats to their values.
  
          Keys:
  
              - 'cpu_vm_percent'
              - 'cpu_percent'
              - 'cpu_swap_percent'
      """
      try:
          import psutil
      except ModuleNotFoundError:
          raise ModuleNotFoundError(
              "`get_cpu_process_metrics` requires `psutil` to be installed."
              " Install it by running `pip install -U psutil`."
          )
  
      process = psutil.Process()
      cpu_times = process.cpu_times()
  
      stats: CPUStats = {
          "cpu_vm_percent": psutil.virtual_memory().percent,
          "cpu_percent": psutil.cpu_percent(),
          "cpu_swap_percent": psutil.swap_memory().percent,
          "worker_cpu_time_user": cpu_times.user,
          "worker_cpu_time_system": cpu_times.system,
          "worker_rss": float(process.memory_info().rss),
      }
      return stats
  
imports: import logging
  import os
  import shutil
  import subprocess
  from collections import defaultdict
  from dataclasses import fields, is_dataclass
  from typing import Any, Dict, Mapping, TypeVar
  import torch
  from torchtnt.utils.version import is_torch_version_geq_1_12
  from typing_extensions import Protocol, runtime_checkable, TypedDict
label_desc: Use image node_id 6 for calling a global function with example usage: get_psutil_cpu_stats() and returns: stats