human
Python 2.7 Counting number of dictionary items with given value
assistant
Here is some code to count the number of values in `d` dictionary that are predicate to function `some_condition`

sum(1 for x in list(d.values()) if some_condition(x))

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.