The itertools.tee function can hold on to objects "unnecessarily". In particular, if you do
iter2 = itertools.tee(iter1, 2)
i.e. you "leak" one of the returned iterators, then all returned objects are not collected until also iter2 is collected.
I propose a different implementation, namely the one in:
streamtee.tee is a drop-in alternative for itertools.tee but as you can see from the test in the repo, it will not hold on to the generated objects as long.
I propose this as an improved implementation of itertools.tee.