He's following the pattern we already had with `got_kbdinit`: because they are grabbed from the surrounding scope, and the `nonlocal` keyword is only python-3, this is the only way to do it.

I considered asking a full re-work of this code into a class to better manage the state, but I'm more worried about doing a big refactor for a small change, that can potentially introduce new bugs inadvertently (especially with code as delicate as this).

Once we switch to python3 only, we can just use `nonlocal` and get rid of this hack.