Please don't use `.keys()` or `.items()` etc, they are expensive in py2 due to them copying the data into a list. Either use `six.iteritems` etc to get iterators, or in this case simply drop `.keys()` as iterating over a dict iterates over the keys anyway.