def _pretty_format(self, statement, result):
if result is None:<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>ret = result<EOL>if statement.action in ("<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>if statement.save_file:<EOL><INDENT>filename = statement.save_file[<NUM_LIT:0>]<EOL>if filename[<NUM_LIT:0>] in ['<STR_LIT:">', "<STR_LIT:'>"]:<EOL><INDENT>filename = unwrap(filename)<EOL><DEDENT>ret = "<STR_LIT>" % (result, plural(result), filename)<EOL><DEDENT>elif isinstance(result, int):<EOL><INDENT>if result == result.scanned_count:<EOL><INDENT>ret = "<STR_LIT>" % result<EOL><DEDENT>else:<EOL><INDENT>ret = "<STR_LIT>" % (result, result.scanned_count)<EOL><DEDENT><DEDENT><DEDENT>elif statement.action == "<STR_LIT>":<EOL><INDENT>if isinstance(result, int):<EOL><INDENT>ret = "<STR_LIT>" % (result, plural(result))<EOL><DEDENT><DEDENT>elif statement.action == "<STR_LIT>":<EOL><INDENT>ret = "<STR_LIT>" % (result, plural(result))<EOL><DEDENT>elif statement.action == "<STR_LIT>":<EOL><INDENT>if result:<EOL><INDENT>ret = "<STR_LIT>" % statement.table<EOL><DEDENT>else:<EOL><INDENT>ret = "<STR_LIT>" % statement.table<EOL><DEDENT><DEDENT>elif statement.action == "<STR_LIT>":<EOL><INDENT>ret = "<STR_LIT>" % (result, plural(result))<EOL><DEDENT>elif statement.action == "<STR_LIT>":<EOL><INDENT>if result:<EOL><INDENT>ret = "<STR_LIT>" % statement.table<EOL><DEDENT>else:<EOL><INDENT>ret = "<STR_LIT>" % statement.table<EOL><DEDENT><DEDENT>elif statement.action == "<STR_LIT>":<EOL><INDENT>ret = self._pretty_format(statement[<NUM_LIT:1>], result)<EOL><DEDENT>elif statement.action == "<STR_LIT>":<EOL><INDENT>ret = "<STR_LIT>" % (result, plural(result))<EOL><DEDENT>return ret<EOL>
Format the return value of a query for humans