def adjust_widths(self, max_width, colstats):
        """ Adjust column widths based on the least negative affect it will
        have on the viewing experience.  We take note of the total character
        mass that will be clipped when each column should be narrowed.  The
        actual score for clipping is based on percentage of total character
        mass, which is the total number of characters in the column. """
        adj_colstats = []
        for x in colstats:
            if not x['preformatted']:
                adj_colstats.append(x)
            else:
                max_width -= x['offt']
        next_score = lambda x: (x['counts'][x['offt']] + x['chop_mass'] +
                                x['chop_count']) / x['total_mass']
        cur_width = lambda: sum(x['offt'] for x in adj_colstats)
        min_width = lambda x: self.width_normalize(
            self.colspec[x['column']]['minwidth'])
        while cur_width() > max_width:
            nextaffects = [(next_score(x), i)
                           for i, x in enumerate(adj_colstats)
                           if x['offt'] > min_width(x)]
            if not nextaffects:
                break  # All columns are as small as they can get.
            nextaffects.sort()
            chop = adj_colstats[nextaffects[0][1]]
            chop['chop_count'] += chop['counts'][chop['offt']]
            chop['chop_mass'] += chop['chop_count']
            chop['offt'] -= 1
Adjust column widths based on the least negative affect it will
        have on the viewing experience.  We take note of the total character
        mass that will be clipped when each column should be narrowed.  The
        actual score for clipping is based on percentage of total character
        mass, which is the total number of characters in the column.