def METHOD_NAME(self, field_names, rows, tab_size=4):
    assert(not rows or len(field_names) == len(rows[0]))
    rows.append(field_names)
    fld_len = len(field_names)
    cls_len = [max(len(c[i]) for c in rows) for i in range(fld_len)]
    del rows[-1]
    cformat = ' '.join('{:<%d}' % i for i in cls_len)
    border = cformat.format(*['='*i for i in cls_len])
    rows = [cformat.format(*row) for row in rows]
    # header
    rows = [border, cformat.format(*field_names), border] + rows
    # footer
    rows += [border]
    # add left margin
    rows = [(' ' * tab_size) + r for r in rows]
    return '\n'.join(rows)