Minor refactoring of pyerr_content()