code: def check_options_choices(options, valid_options):
      """Check if an option value is among the option's choices, when choices exist.
  
      Parameters
      ----------
      options: dict
          dict indexed by option name of options and options values to be checked.
  
      valid_options: list of dict
          list of all valid options and choices for a platform.
  
      Returns
      -------
      None. Raise TVMCException if check fails, i.e. if an option value is not valid.
  
      """
      # Dict of all valid options and associated valid choices.
      # Options with no choices are excluded from the dict.
      valid_options_choices = {
          opt["name"]: opt["choices"]
          for opt in valid_options
          if opt["choices"] is not None
      }
  
      for option in options:
          if option in valid_options_choices:
              if options[option] not in valid_options_choices[option]:
                  raise TVMCException(
                      f"Choice '{options[option]}' for option '{option}' is invalid. "
                      "Use --list-options to see all available choices for that option."
                  )
  
file_path: tvm/python/tvm/driver/tvmc/project.py
imports: import os
  import pathlib
  from collections import defaultdict
  from typing import Union
  from .None import TVMCException
  from .fmtopt import format_option
label_desc: Use image node_id 4 for calling a global function with example usage: check_options_choices(options, valid_options) without return types