def count_if(my_list, key, value):
    """
    return number of records in my_list where key==value pair matches
    """
    counter = (1 for item in my_list if item.get(key) == value)
    return sum(counter)