code: def collect(detail: bool) -> SystemInfo | None:
      try:
          nvmlInit()
      except Exception as e:
          errors.add(f"init: {e}")
          return None
  
      info = None
      try:
          info = SystemInfo(detail)
      except Exception as e:
          errors.add(f"unexpected: {e}")
  
      try:
          nvmlShutdown()
      except Exception as e:
          errors.add(f"shutdown: {e}")
  
      return info
  
file_path: nni/nni/tools/nni_manager_scripts/collect_gpu_info.py
imports: from __future__ import annotations
  from dataclasses import asdict, dataclass
  import json
  import sys
  from typing import Any, Literal
  from pynvml import *
label_desc: Use image node_id 3 for calling a global function with example usage: collect(detail) and returns: info, None