I made the requested changes, though I did so reluctantly for the following reasons:

1. I wrote it as a lambda so that the function wouldn't be exposed to the WindowBase API. While writing  function as '__exit' mitigates the issue, it's still technically made available, albiet through some name mangling

2. The only thing that could go wrong would be for a non-truthy value to be set, in which case, converting to a boolean will always be True. No exception would be thrown anyway. If that isn't desired, then it's easy enough to raise an appropriate exception within on_keyboard itself.

3. The only unreadable lambda traceback is a lambda called incorrectly, and given that this one is called with exactly 3 arguments as specified y add_callback, that wouldn't be an issue.