code: def script_args_to_labels(
      script_args: Optional[List[str]],
  ) -> Dict[str, str]:
      """Converts the arguments supplied to our scripts into a dictionary usable as
      labels valid for Cloud submission.
  
      """
      ret = {}
  
      def process_pair(k, v):
          if ua.is_key(k):
              clean_k = key_label(k)
              if clean_k != "":
                  ret[clean_k] = "" if ua.is_key(v) else value_label(v)
  
      if script_args is None or len(script_args) == 0:
          return ret
  
      elif len(script_args) == 1:
          process_pair(script_args[0], None)
  
      # Handle the case where the final argument in the list is a boolean flag.
      # This won't get picked up by partition.
      elif len(script_args) > 1:
          for k, v in u.partition(script_args, 2):
              process_pair(k, v)
  
          process_pair(script_args[-1], None)
  
      return ret
  
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 5 for calling a global function with example usage: script_args_to_labels(script_args) and returns: ret, ret