Honestly I am a little confused here, why can\'t I iterate twice over the same data?
def _view(self,dbName):
db = self.dictDatabases[dbName]
data = d
I want to complete the answer of @ÓscarLópez for them who looks for a solution in 2017 and uses python 2.7 or 3.
Method tee() takes no keyword arguments now and waits for the second argument an integer, not keyword. This is the right way to use tee():
import itertools
it1, it2 = itertools.tee(db[3], 2)