def dump(self, conf_file=None):
if conf_file:<EOL><INDENT>conf_dir = os.path.dirname(conf_file)<EOL>if not conf_dir:<EOL><INDENT>conf_dir = self.__invoke_dir<EOL><DEDENT>elif not os.path.exists(conf_dir):<EOL><INDENT>os.makedirs(conf_dir)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>conf_dir = self.__conf_dir<EOL><DEDENT>final_conf = {}<EOL>for key, value in list(self.__config.items()):<EOL><INDENT>if key in self.__cli:<EOL><INDENT>continue<EOL><DEDENT>final_conf[key] = value<EOL><DEDENT>for key, value in list(self.__cli.items()):<EOL><INDENT>if key.endswith('<STR_LIT:index>') or key in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>path = self.__abspath(value, from_conf=False)<EOL>if path:<EOL><INDENT>relpath = os.path.relpath(path, conf_dir)<EOL>final_conf[key] = relpath<EOL><DEDENT><DEDENT>elif key.endswith('<STR_LIT>') or key.endswith('<STR_LIT>'):<EOL><INDENT>new_list = []<EOL>for path in value:<EOL><INDENT>path = self.__abspath(path, from_conf=False)<EOL>if path:<EOL><INDENT>relpath = os.path.relpath(path, conf_dir)<EOL>new_list.append(relpath)<EOL><DEDENT><DEDENT>final_conf[key] = new_list<EOL><DEDENT>elif key not in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>final_conf[key] = value<EOL><DEDENT><DEDENT>with open(conf_file or self.conf_file or '<STR_LIT>', '<STR_LIT:w>') as _:<EOL><INDENT>_.write(json.dumps(final_conf, sort_keys=True, indent=<NUM_LIT:4>))<EOL><DEDENT>
Dump the possibly updated config to a file.

Args:
    conf_file: str, the destination, or None to overwrite the
        existing configuration.