def get_param_map(word, required_keys=None):
if required_keys is None:<EOL><INDENT>required_keys = []<EOL><DEDENT>words = word.split("<STR_LIT:U+002C>")<EOL>param_map = {}<EOL>for wordi in words:<EOL><INDENT>if "<STR_LIT:=>" not in wordi:<EOL><INDENT>key = wordi.strip()<EOL>value = None<EOL><DEDENT>else:<EOL><INDENT>sword = wordi.split("<STR_LIT:=>")<EOL>assert len(sword) == <NUM_LIT:2>, sword<EOL>key = sword[<NUM_LIT:0>].strip()<EOL>value = sword[<NUM_LIT:1>].strip()<EOL><DEDENT>param_map[key] = value<EOL><DEDENT>msg = "<STR_LIT>"<EOL>for key in required_keys:<EOL><INDENT>if key not in param_map:<EOL><INDENT>msg += "<STR_LIT>" % (key, word)<EOL><DEDENT><DEDENT>if msg:<EOL><INDENT>raise RuntimeError(msg)<EOL><DEDENT>return param_map<EOL>
get the optional arguments on a line

Example
-------
>>> iline = 0
>>> word = 'elset,instance=dummy2,generate'
>>> params = get_param_map(iline, word, required_keys=['instance'])
params = {
    'elset' : None,
    'instance' : 'dummy2,
    'generate' : None,
}