Force expansion of contents rather than iterator.

Python 3 implicitly uses an iterator in a for loop,
but we're deleting things from the dict so we need
to explicitly expand in advance.