In Python 3 OrderedDict.keys() are not indexable

We could always cast counts.keys() to a list, from the "dictionary view" type, but a more efficient way of doing this is to simply pop the items from our result list as we traverse the returned iterable dictionary view.

(fixes test issues where Python3 complains that 'KeysView' object is not indexable)