If you want to get the elements of an iterable that a function returns true, use filter.
In the code above, I use the filter method to get items that are fruits.
Link to the source code.