def make_table(data, col_names):
    """Code for this RST-formatted table generator comes from
    http://stackoverflow.com/a/11350643
    """
    n_cols = len(data[0])
    assert n_cols == len(col_names)
    col_sizes = [max(len(r[i]) for r in data) for i in range(n_cols)]
    for i, cname in enumerate(col_names):
        if col_sizes[i] < len(cname):
            col_sizes[i] = len(cname)
    formatter = ' '.join('{:<%d}' % c for c in col_sizes)
    rows = '\n'.join([formatter.format(*row) for row in data])
    header = formatter.format(*col_names)
    divider = formatter.format(*['=' * c for c in col_sizes])
    output = '\n'.join((divider, header, divider, rows, divider))
    return output