Merged requested to merge bitbucket/merged-pr-232 into branch/2.5
Created originally on Bitbucket by jdufresne (Jon Dufresne)
Was already merged in Bitbucket before import, marked as merged by the import user
Removes unnecessary calls to .keys().
Inspired by Lennart Regebro's talk "Prehistoric Patterns in Python" from PyCon 2017.
For the talk, see: