def count_function(lst, number, value=1):
    return all(x.count(value) == number for x in lst)
L = [[0, 1, 1, 1], [1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1, 0]]
Python counting elements of a list within a list