code: def load_options(
      list_of_options,
      descr="Algorithm",
      reporter=None,
      cmd_line=False,
      partial_options=None,
  ):
      """Given a list of options, this reads them from the command line and returns
      a namespace with the values.
      """
      parser = argparse.ArgumentParser(description=descr)
      opt_names_default_parsed = {}
      for elem in list_of_options:
          opt_dict = deepcopy(elem)
          opt_name = opt_dict.pop("name")
          opt_names_default_parsed[opt_name] = [
              opt_dict["default"],
              None,
          ]
          if not opt_name.startswith("--"):
              opt_name = "--" + opt_name
          if opt_name == "--options":
              opt_dict["type"] = open
              opt_dict["action"] = LoadFromFile
          parser.add_argument(opt_name, **opt_dict)
      if cmd_line:
          args, _ = parser.parse_known_args()
      else:
          args = parser.parse_args(args=[])
      for key in opt_names_default_parsed:
          opt_names_default_parsed[key][1] = getattr(args, key)
      _print_options(opt_names_default_parsed, descr, reporter)
      # Now override with what is available in partial options
      if partial_options is not None:
          if isinstance(partial_options, dict):
              partial_options_dict = partial_options
          else:
              partial_options_dict = vars(partial_options)
          # Now override
          for key, val in partial_options_dict.items():
              setattr(args, key, val)
      return args
  
file_path: dragonfly/dragonfly/utils/option_handler.py
imports: import argparse
  from copy import deepcopy
label_desc: Use image node_id 3 for calling a global function with example usage: load_options(list_of_options, descr, reporter, cmd_line, partial_options) and returns: args