def format_answers(self, fmt='<STR_LIT>'):
fmts = ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>')<EOL>if fmt not in fmts:<EOL><INDENT>eprint("<STR_LIT>".format(fmt, fmts))<EOL>return<EOL><DEDENT>def stringify(val):<EOL><INDENT>if type(val) in (list, tuple):<EOL><INDENT>return '<STR_LIT:U+002CU+0020>'.join(str(e) for e in val)<EOL><DEDENT>return val<EOL><DEDENT>if fmt == '<STR_LIT>':<EOL><INDENT>return json.dumps(self.answers)<EOL><DEDENT>elif fmt == '<STR_LIT>':<EOL><INDENT>answers = [[k, v] for k, v in self.answers.items()]<EOL>return json.dumps(answers)<EOL><DEDENT>elif fmt == '<STR_LIT>':<EOL><INDENT>answers = '<STR_LIT:\n>'.join('<STR_LIT>'.format(k, stringify(v)) for k, v in self.answers.items())<EOL>return answers<EOL><DEDENT>
Formats answers depending on `fmt`.