def get_lines_positions(fmap, bucket_size=1):
    """Return the mmap indexes that identify the lines in the mmap. Bucket_size is the the number of lines that each bucket should contain"""

    positions = [[0, 1]]
    bucket_counter = 1
    while fmap.readline():
        if bucket_counter % bucket_size == 0:
            positions.append([fmap.tell(), 1])
        else:
            positions[-1][1] += 1
        bucket_counter += 1

    # remove the las positions, since it index the end of the eof 
    return positions