def _pretty_format(self, statement, result):
        """ Format the return value of a query for humans """
        if result is None:
            return "Success"
        ret = result
        if statement.action in ("SELECT", "SCAN"):
            if statement.save_file:
                filename = statement.save_file[0]
                if filename[0] in ['"', "'"]:
                    filename = unwrap(filename)
                ret = "Saved %d record%s to %s" % (result, plural(result), filename)
            elif isinstance(result, int):
                if result == result.scanned_count:
                    ret = "%d" % result
                else:
                    ret = "%d (scanned count: %d)" % (result, result.scanned_count)
        elif statement.action == "UPDATE":
            if isinstance(result, int):
                ret = "Updated %d item%s" % (result, plural(result))
        elif statement.action == "DELETE":
            ret = "Deleted %d item%s" % (result, plural(result))
        elif statement.action == "CREATE":
            if result:
                ret = "Created table %r" % statement.table
            else:
                ret = "Table %r already exists" % statement.table
        elif statement.action == "INSERT":
            ret = "Inserted %d item%s" % (result, plural(result))
        elif statement.action == "DROP":
            if result:
                ret = "Dropped table %r" % statement.table
            else:
                ret = "Table %r does not exist" % statement.table
        elif statement.action == "ANALYZE":
            ret = self._pretty_format(statement[1], result)
        elif statement.action == "LOAD":
            ret = "Loaded %d item%s" % (result, plural(result))
        return ret
Format the return value of a query for humans