def count_tuples(map):
    """ @brief counts non zero tuples in a map
    @param map BitArray containing the bitmap
    @return Count of non-zero bytes in the bitmap"""

    count = 0
    
    if map != None:
        for bit in map.tobytes():
            if bit != 0:
                count += 1
    
    return count