code: def _parse_visible_devices() -> Union[List[int], List[str]]:
      """Parse CUDA_VISIBLE_DEVICES environment variable."""
      var = os.getenv("CUDA_VISIBLE_DEVICES")
      if var is None:
          return list(range(64))
  
      def _strtoul(s: str) -> int:
          """Return -1 or positive integer sequence string starts with,"""
          if not s:
              return -1
          for idx, c in enumerate(s):
              if not (c.isdigit() or (idx == 0 and c in "+-")):
                  break
              if idx + 1 == len(s):
                  idx += 1
          return int(s[:idx]) if idx > 0 else -1
  
      def parse_list_with_prefix(lst: str, prefix: str) -> List[str]:
          rcs: List[str] = []
          for elem in lst.split(","):
              # Repeated id results in empty set
              if elem in rcs:
                  return cast(List[str], [])
              # Anything other but prefix is ignored
              if not elem.startswith(prefix):
                  break
              rcs.append(elem)
          return rcs
  
      if var.startswith("GPU-"):
          return parse_list_with_prefix(var, "GPU-")
      if var.startswith("MIG-"):
          return parse_list_with_prefix(var, "MIG-")
      # CUDA_VISIBLE_DEVICES uses something like strtoul
      # which makes `1gpu2,2ampere` is equivalent to `1,2`
      rc: List[int] = []
      for elem in var.split(","):
          x = _strtoul(elem.strip())
          # Repeated ordinal results in empty set
          if x in rc:
              return cast(List[int], [])
          # Negative value aborts the sequence
          if x < 0:
              break
          rc.append(x)
      return rc
  
imports: import os
  import warnings
  from contextlib import contextmanager
  from functools import lru_cache
  from typing import Generator, List, Optional, Union, cast
  import torch
  from typing_extensions import override
  from lightning.fabric.accelerators.accelerator import Accelerator
  from lightning.fabric.accelerators.registry import _AcceleratorRegistry
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_0
  from lightning.fabric.utilities.rank_zero import rank_zero_info
label_desc: Use image node_id 6 for calling a global function with example usage: _parse_visible_devices() and returns: rc, list, unknown, rcs, parse_list_with_prefix, parse_list_with_prefix, unknown, cast, cast