src/hook: Python 3 fixes