def find_peak(data, cutoff=.9):
    '''
    This will look for the point where cumulative cutoff is reached. For
    example:

    >>> find_peak({0: 27, 1: 71, 2: 1})
    1
    '''
    total_length = sum(data.values())
    count_cutoff = cutoff * total_length
    cum_sum = 0
    for i, count in sorted(data.items()):
        cum_sum += count
        if cum_sum > count_cutoff:
            return i
def find_peak ( data , cutoff = .9 ) : total_length = sum ( data . values ( ) ) count_cutoff = cutoff * total_length cum_sum = 0 for i , count in sorted ( data . items ( ) ) : cum_sum += count if cum_sum > count_cutoff : return i
This will look for the point where cumulative cutoff is reached. For
    example:

    >>> find_peak({0: 27, 1: 71, 2: 1})
    1