implement Design Pattern "Iterator"
Implement the iterator (and maybe the distributor) class following the Design Pattern for iterators. The current iterator would be split into the Collector and the Iterator. The collector has the __iter__
method and the __next__
method is part of iterator. See draft below for explanation and take a look here.