def write_config(cfg):
cfg_path = '<STR_LIT>'<EOL>cfg_file = '<STR_LIT>'<EOL>cfg_lines = []<EOL>if not isinstance(cfg, FreelanCFG):<EOL><INDENT>if not isinstance(cfg, (list, tuple)):<EOL><INDENT>print("<STR_LIT>")<EOL>return<EOL><DEDENT>cfg_lines = cfg<EOL><DEDENT>else:<EOL><INDENT>cfg_lines = cfg.build()<EOL><DEDENT>if not os.path.isdir(cfg_path):<EOL><INDENT>print("<STR_LIT>")<EOL>return<EOL><DEDENT>cfg_file_path = os.path.join(cfg_path,cfg_file)<EOL>if os.path.isfile( cfg_file_path ):<EOL><INDENT>print("<STR_LIT>")<EOL>ts = time.time()<EOL>backup_file = cfg_file_path+'<STR_LIT>'+datetime.datetime.fromtimestamp(ts).strftime('<STR_LIT>')<EOL>shutil.move(cfg_file_path, backup_file)<EOL><DEDENT>cfg_lines = [cfg_line+'<STR_LIT:\n>' for cfg_line in cfg_lines]<EOL>with open(cfg_file_path, '<STR_LIT:w>') as cfg_f:<EOL><INDENT>cfg_f.writelines(cfg_lines)<EOL><DEDENT>
try writing config file to a default directory