Port `event_rpcgen.py` and `test/check-dumpevents.py` to Python 3. These scripts remain compatible with Python 2. (cherry picked from commit 8b0aa7b36a3250fad4953f194c8a94ab25032583)