code: def _convert_precision_to_unified_args(
      precision: Optional[_PRECISION_INPUT],
  ) -> Optional[_PRECISION_INPUT_STR]:
      if precision is None:
          return None
  
      supported_precision = (
          get_args(_PRECISION_INPUT_STR)
          + get_args(_PRECISION_INPUT_INT)
          + get_args(_PRECISION_INPUT_STR_ALIAS)
      )
      if precision not in supported_precision:
          raise ValueError(
              f"Precision {repr(precision)} is invalid. Allowed precision values: {supported_precision}"
          )
  
      precision = str(
          precision
      )  # convert int flags to str here to enable the legacy-conversion below
  
      if precision in get_args(_PRECISION_INPUT_STR_ALIAS):
          if str(precision)[:2] not in ("32", "64"):
              rank_zero_warn(
                  f"`precision={precision}` is supported for historical reasons but its usage is discouraged. "
                  f"Please set your precision to {_PRECISION_INPUT_STR_ALIAS_CONVERSION[precision]} instead!"
              )
          precision = _PRECISION_INPUT_STR_ALIAS_CONVERSION[precision]
      return cast(_PRECISION_INPUT_STR, precision)
  
imports: import os
  from collections import Counter
  from typing import Any, Dict, List, Optional, Union, cast
  import torch
  from typing_extensions import get_args
  from lightning.fabric.accelerators import ACCELERATOR_REGISTRY
  from lightning.fabric.accelerators.accelerator import Accelerator
  from lightning.fabric.accelerators.cuda import CUDAAccelerator
  from lightning.fabric.accelerators.mps import MPSAccelerator
  from lightning.fabric.accelerators.xla import XLAAccelerator
  from lightning.fabric.plugins import CheckpointIO, DeepSpeedPrecision, HalfPrecision, MixedPrecision, Precision, TransformerEnginePrecision, XLAPrecision
  from lightning.fabric.plugins.environments import ClusterEnvironment, LightningEnvironment, LSFEnvironment, MPIEnvironment, SLURMEnvironment, TorchElasticEnvironment
  from lightning.fabric.plugins.precision.double import DoublePrecision
  from lightning.fabric.plugins.precision.fsdp import FSDPPrecision
  from lightning.fabric.plugins.precision.precision import _PRECISION_INPUT, _PRECISION_INPUT_INT, _PRECISION_INPUT_STR, _PRECISION_INPUT_STR_ALIAS, _PRECISION_INPUT_STR_ALIAS_CONVERSION
  from lightning.fabric.strategies import STRATEGY_REGISTRY, DeepSpeedStrategy, ParallelStrategy, SingleDeviceStrategy, SingleDeviceXLAStrategy, Strategy, XLAFSDPStrategy, XLAStrategy
  from lightning.fabric.strategies.ddp import _DDP_FORK_ALIASES
  from lightning.fabric.strategies.fsdp import _FSDP_ALIASES, FSDPStrategy
  from lightning.fabric.utilities import rank_zero_info, rank_zero_warn
  from lightning.fabric.utilities.device_parser import _determine_root_gpu_device
  from lightning.fabric.utilities.imports import _IS_INTERACTIVE
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_precision_to_unified_args(precision) and returns: cast, None