def dump_config_file(filename, args, parser=None):
config = ConfigParser()<EOL>config.add_section(SECTION)<EOL>if parser is None:<EOL><INDENT>for attr in args:<EOL><INDENT>config.set(SECTION, attr, args.attr)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>keys_empty_values_not_pass = (<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>')<EOL>for action in parser._actions:<EOL><INDENT>if action.dest in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>continue<EOL><DEDENT>keyp = action.option_strings[<NUM_LIT:0>]<EOL>option_name = keyp.lstrip('<STR_LIT:->')<EOL>option_value = getattr(args, action.dest)<EOL>if any([i for i in keys_empty_values_not_pass if i in action.option_strings]):<EOL><INDENT>if action.dest == '<STR_LIT>':<EOL><INDENT>if len(option_value) == <NUM_LIT:1> and option_value[<NUM_LIT:0>] == '<STR_LIT>':<EOL><INDENT>config.set(SECTION, option_name, '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>config.set(SECTION, option_name, '<STR_LIT:U+002C>'.join(option_value))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>config.set(SECTION, option_name, option_value if option_value else '<STR_LIT>')<EOL><DEDENT><DEDENT>elif action.choices == ('<STR_LIT:yes>', '<STR_LIT>'):<EOL><INDENT>config.set(SECTION, option_name, '<STR_LIT:yes>' if option_value else '<STR_LIT>')<EOL><DEDENT>elif action.dest == '<STR_LIT>':<EOL><INDENT>config.set(SECTION, option_name, option_value if option_value else '<STR_LIT>')<EOL><DEDENT>elif action.dest == '<STR_LIT>':<EOL><INDENT>version = ('<STR_LIT>' if option_value == CMS_VERSION_MATRIX['<STR_LIT>']<EOL>else option_value)<EOL>config.set(SECTION, option_name, version)<EOL><DEDENT>elif action.dest == '<STR_LIT>':<EOL><INDENT>version = ('<STR_LIT>' if option_value == DJANGO_VERSION_MATRIX['<STR_LIT>']<EOL>else option_value)<EOL>config.set(SECTION, option_name, version)<EOL><DEDENT>elif action.const:<EOL><INDENT>config.set(SECTION, option_name, '<STR_LIT:true>' if option_value else '<STR_LIT:false>')<EOL><DEDENT>else:<EOL><INDENT>config.set(SECTION, option_name, str(option_value))<EOL><DEDENT><DEDENT><DEDENT>with open(filename, '<STR_LIT:w>') as fp:<EOL><INDENT>config.write(fp)<EOL><DEDENT>
Dump args to config file.