Replace the weird try/except flow with if/else. Use dict for faster checksum lookup