code: def sanitize_labels(
      pairs: Union[Dict[str, str], List[Tuple[str, str]]]
  ) -> Dict[str, str]:
      """Turns a dict, or a list of unsanitized key-value pairs (each represented by
      a tuple) into a dictionary suitable to submit to Cloud as a label dict.
  
      """
      if isinstance(pairs, dict):
          return sanitize_labels(pairs.items())
  
      return {
          key_label(k): value_label(v)
          for (k, v) in pairs
          if key_label(k)
      }
  
file_path: caliban/caliban/platform/cloud/util.py
imports: import re
  from typing import Dict, List, Optional, Tuple, Union
  import caliban.util
  import caliban.util.argparse
label_desc: Use image node_id 6 for calling a global function with example usage: sanitize_labels(pairs) and returns: unknown, sanitize_labels