def chunks_in_region_file(filename):
    """Return the number of chunks generated in a region file."""

    chunks = 0

    with open(filename, 'rb') as f:
        for i in range(1024):
            entry = f.read(4)
            if entry[-1] != 0:
                chunks += 1

    return chunks