code: def get_and_check_options(passed_options, valid_options):
      """Get options and check if they are valid.  If choices exist for them, check values against it.
  
      Parameters
      ----------
      passed_options: list of str
          list of strings in the "key=value" form as captured by argparse.
  
      valid_option: list
          list with all options available for a given API method / project as returned by
          get_project_options().
  
      Returns
      -------
      opts: dict
          dict indexed by option names and associated values.
  
      Or None if passed_options is None.
  
      """
  
      if passed_options is None:
          # No options to check
          return None
  
      # From a list of k=v strings, make a dict options[k]=v
      opts = get_options(passed_options)
      # Check if passed options are valid
      check_options(opts, valid_options)
      # Check (when a list of choices exists) if the passed values are valid
      check_options_choices(opts, valid_options)
  
      return opts
  
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 5 for calling a global function with example usage: get_and_check_options(passed_options, valid_options) and returns: opts, None