def scrape_options_and_index_by_dest(*parsers_and_groups):
 all_options = {}
 job_option_lists = [g.option_list for g in parsers_and_groups]
 for option in itertools.chain(*job_option_lists):
  other_options = all_options.get(option.dest, [])
  other_options.append(option)
  all_options[option.dest] = other_options
 return all_options

def scrape_options_and_index_by_dest ( * parsers_and_groups ) : all_options = { } job_option_lists = [ g . option_list for g in parsers_and_groups ] for option in itertools . chain ( * job_option_lists ) : other_options = all_options . get ( option . dest , [ ] ) other_options . append ( option ) all_options [ option . dest ] = other_options return all_options
scrapes optparse options from :py:class:optionparser and :py:class:optiongroup objects and builds a dictionary of dest_var: [option1 .