code: def _parse_cpu_cores(cpu_cores: Union[int, str, List[int]]) -> int:
      """Parses the cpu_cores given in the format as accepted by the ``devices`` argument in the
      :class:`~lightning.pytorch.trainer.trainer.Trainer`.
  
      Args:
          cpu_cores: An int > 0.
  
      Returns:
          An int representing the number of processes
  
      Raises:
          MisconfigurationException:
              If cpu_cores is not an int > 0
  
      """
      if isinstance(cpu_cores, str) and cpu_cores.strip().isdigit():
          cpu_cores = int(cpu_cores)
  
      if not isinstance(cpu_cores, int) or cpu_cores <= 0:
          raise TypeError(
              "`devices` selected with `CPUAccelerator` should be an int > 0."
          )
  
      return cpu_cores
  
file_path: pytorch-lightning/src/lightning/fabric/accelerators/cpu.py
imports: from typing import List, Union
  import torch
  from typing_extensions import override
  from lightning.fabric.accelerators.accelerator import Accelerator
  from lightning.fabric.accelerators.registry import _AcceleratorRegistry
label_desc: Use image node_id 1 for calling a global function with example usage: _parse_cpu_cores(cpu_cores) and returns: cpu_cores