<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format(self, result):
 """Generate plain text report. :return: Report body :rtype: str """

        m = self.meta
        lines = ['-' * len(self.TITLE),
                 self.TITLE,
                 '-' * len(self.TITLE),
                 "Compared: {db1} <-> {db2}".format(**m),
                 "Filter: {filter}".format(**m),
                 "Run time: {start_time} -- {end_time} ({elapsed:.1f} sec)".format(**m),
                 ""]
        for section in result.keys():
            lines.append("* " + section.title())
            indent = " " * 4
            if len(result[section]) == 0:
                lines.append("{}EMPTY".format(indent))
            else:
                keyset, maxwid = self.result_subsets(result[section])
                for columns in keyset:
                    ocol = self.ordered_cols(columns, section)
                    mw = maxwid[columns]
                    mw_i = [columns.index(c) for c in ocol]  # reorder indexes
                    fmt = '  '.join(["{{:{:d}s}}".format(mw[i]) for i in mw_i])
                    lines.append("")
                    lines.append(indent + fmt.format(*ocol))
                    lines.append(indent + '-_' * (sum(mw)/2 + len(columns)))
                    rows = result[section]
                    self.sort_rows(rows, section)
                    for r in rows:
                        key = tuple(sorted(r.keys()))
                        if key == columns:
                            values = [str(r[k]) for k in ocol]
                            lines.append(indent + fmt.format(*values))
        return '\n'.join(lines)