test_data = [{'key1': 'value1', 'key2': 'value2'}, {'key1': 'blabla'}, {
    'key1': 'value1', 'eh': 'uh'}]
list(filter_data(test_data, lambda k, v: k == 'key1' and v == 'value1'))
Filtering dictionaries and creating sub-dictionaries based on keys/values in Python?