Factor-out the common code for setting a KeyError.
4 files changed