'Find the top/least <length> items (by total)
@param items: the items as list of tuples
(index, sort-total, totals, header)
@param length: the maximum number of items
@param least: find least rather than top
@param facts: the facts to aggregate the tail totals'

@classmethod
def _tail(cls, items, length=10, least=False, facts=None):

    try:
        if (len(items) > length):
            l = list(items)
            l.sort((lambda x, y: int((y[1] - x[1]))))
            if least:
                l.reverse()
            keys = [item[0] for item in l[(length - 1):]]
            totals = []
            for (i, fact) in enumerate(facts):
                subtotals = [item[2][i] for item in l[(length - 1):]]
                totals.append(fact.aggregate_totals(subtotals))
            return (keys, totals[0], totals)
    except (TypeError, ValueError):
        pass
    return (None, None)
