code: def _transform_uuid_to_ordinals(
      candidates: List[str], uuids: List[str]
  ) -> List[int]:
      """Given the set of partial uuids and list of known uuids builds a set of ordinals excluding ambiguous partials
      IDs."""
  
      def uuid_to_orinal(candidate: str, uuids: List[str]) -> int:
          best_match = -1
          for idx, uuid in enumerate(uuids):
              if not uuid.startswith(candidate):
                  continue
              # Ambigous candidate
              if best_match != -1:
                  return -1
              best_match = idx
          return best_match
  
      rc: List[int] = []
      for candidate in candidates:
          idx = uuid_to_orinal(candidate, uuids)
          # First invalid ordinal stops parsing
          if idx < 0:
              break
          # Duplicates result in empty set
          if idx in rc:
              return cast(List[int], [])
          rc.append(idx)
      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 9 for calling a global function with example usage: _transform_uuid_to_ordinals(candidates, uuids) and returns: rc, best_match, cast, unknown