def addDictOption(opts, choicesDict, default, name, helpStr=None):
 if (default not in choicesDict):
  raise Exception(('Invalid  default %s for choices dict: %s' % (default, name)))
 if (not helpStr):
  helpStr = ('|'.join(sorted(choicesDict.keys())) + '[,param=value...]')
 opts.add_option(('--' + name), type='string', default=default, help=helpStr)

def addDictOption ( opts , choicesDict , default , name , helpStr = None ) : if ( default not in choicesDict ) : raise Exception ( ( 'Invalid  default %s for choices dict: %s' % ( default , name ) ) ) if ( not helpStr ) : helpStr = ( '|' . join ( sorted ( choicesDict . keys ( ) ) ) + '[,param=value...]' ) opts . add_option ( ( '--' + name ) , type = 'string' , default = default , help = helpStr )
convenience function to add choices dicts to optionparser .