Reusable iterators in python