def _parse_extra_args(self, api, extra_args_raw):
extra_args = {}<EOL>def die(m, extra_arg_raw):<EOL><INDENT>print('<STR_LIT>' % (m, extra_arg_raw),<EOL>file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>for extra_arg_raw in extra_args_raw:<EOL><INDENT>try:<EOL><INDENT>extra_arg = json.loads(extra_arg_raw)<EOL><DEDENT>except ValueError as e:<EOL><INDENT>die(str(e), extra_arg_raw)<EOL><DEDENT>if '<STR_LIT>' not in extra_arg:<EOL><INDENT>die('<STR_LIT>', extra_arg_raw)<EOL><DEDENT>elif (not isinstance(extra_arg['<STR_LIT>'], list) or<EOL>len(extra_arg['<STR_LIT>']) != <NUM_LIT:2>):<EOL><INDENT>die('<STR_LIT>', extra_arg_raw)<EOL><DEDENT>elif (not isinstance(extra_arg['<STR_LIT>'][<NUM_LIT:0>], six.text_type) or<EOL>not isinstance(extra_arg['<STR_LIT>'][<NUM_LIT:1>], six.text_type)):<EOL><INDENT>print(type(extra_arg['<STR_LIT>'][<NUM_LIT:0>]))<EOL>die('<STR_LIT>', extra_arg_raw)<EOL><DEDENT>elif '<STR_LIT>' not in extra_arg:<EOL><INDENT>die('<STR_LIT>', extra_arg_raw)<EOL><DEDENT>elif not isinstance(extra_arg['<STR_LIT>'], six.text_type):<EOL><INDENT>die('<STR_LIT>', extra_arg_raw)<EOL><DEDENT>elif '<STR_LIT>' not in extra_arg:<EOL><INDENT>die('<STR_LIT>', extra_arg_raw)<EOL><DEDENT>elif not isinstance(extra_arg['<STR_LIT>'], six.text_type):<EOL><INDENT>die('<STR_LIT>', extra_arg_raw)<EOL><DEDENT>elif ('<STR_LIT>' in extra_arg and<EOL>not isinstance(extra_arg['<STR_LIT>'], six.text_type)):<EOL><INDENT>die('<STR_LIT>', extra_arg_raw)<EOL><DEDENT>attr_key, attr_val = extra_arg['<STR_LIT>'][<NUM_LIT:0>], extra_arg['<STR_LIT>'][<NUM_LIT:1>]<EOL>extra_args.setdefault(attr_key, {})[attr_val] =(extra_arg['<STR_LIT>'], extra_arg['<STR_LIT>'],<EOL>extra_arg.get('<STR_LIT>'))<EOL><DEDENT>extra_args_for_types = {}<EOL>for namespace in api.namespaces.values():<EOL><INDENT>for route in namespace.routes:<EOL><INDENT>extra_parameters = []<EOL>if is_user_defined_type(route.arg_data_type):<EOL><INDENT>for attr_key in route.attrs:<EOL><INDENT>if attr_key not in extra_args:<EOL><INDENT>continue<EOL><DEDENT>attr_val = route.attrs[attr_key]<EOL>if attr_val in extra_args[attr_key]:<EOL><INDENT>extra_parameters.append(extra_args[attr_key][attr_val])<EOL><DEDENT><DEDENT><DEDENT>if len(extra_parameters) > <NUM_LIT:0>:<EOL><INDENT>extra_args_for_types[route.arg_data_type] = extra_parameters<EOL><DEDENT><DEDENT><DEDENT>return extra_args_for_types<EOL>
Parses extra arguments into a map keyed on particular data types.