code: def align_target_label(
      targets: List[float],
      labels: List[str],
      label_vocab: Dict[str, int],
  ) -> List[float]:
      """
      Given `targets` that are ordered according to `labels`, align the targets to match
      the order of `label_vocab`.
      """
      assert sorted(labels) == sorted(label_vocab)
      assert len(targets) == len(labels)
      aligned_targets = [None] * len(targets)
      for target, label in zip(targets, labels):
          aligned_targets[label_vocab[label]] = target
      assert all(t is not None for t in aligned_targets)
      return aligned_targets
  
imports: import itertools
  from collections import Counter
  from typing import Dict, List, Optional, Tuple
  import torch
  from pytext.common.constants import SpecialTokens, Token
  from pytext.utils import cuda, precision
label_desc: Use image node_id 8 for calling a global function with example usage: align_target_label(targets, labels, label_vocab) and returns: aligned_targets