I happened to find myself having a basic filtering need: I have a list and I have to filter it by an attribute of the items.
My code looked like this:
My take
def filter_list(list, key, value, limit=None): return [i for i in list if i[key] == value][:limit]