using python iterators and generators