Fixed #20094 - Be more careful when checking for Iterator.

Python 2.6 has some different behaviour when checking
isinstance(foo, collections.Iterator).