i don't have a bluetooth kb to test this with, but I think this should now work:
https://github.com/jsbain/objc_hacks/blob/master/keycommands.py
Run it once, the check that there are no assertions. Then try cmd-h to see if 'hi' is printed to the console again.