Takes an iterator and outputs a subset of it.