Support iterators with incompletely defined __len__ functions (#2445)
* support iterators with incompletely defined __len__ functions
* whitespace fix
---------
Co-authored-by: Logan Adams <114770087+loadams@users.noreply.github.com>
Co-authored-by: Logan Adams <loadams@microsoft.com>