Rewrite error translations to match Python 3 messages, add tests for it