Refactoring pycore/dumpcore.py