def offsets_for_max_size( max_size ):
    """
    Return the subset of offsets needed to contain intervals over (0,max_size)
    """
    for i, max in enumerate( reversed( BIN_OFFSETS_MAX ) ):
        if max_size < max:
            break
    else:
        raise Exception( "%d is larger than the maximum possible size (%d)" % ( max_size, BIN_OFFSETS_MAX[0] ) )
    return BIN_OFFSETS[ ( len(BIN_OFFSETS) - i - 1 ) : ]
Return the subset of offsets needed to contain intervals over (0,max_size)