added filtering for iterators

Added a set of functions for performing filtering on iterators.