Subj. I tried to do it myself (and make a pull request), but it looks like I don't fully understand how i3ipc-python handles events, so it didn't work. What I want is to be able to subscribe to "input" event, which is issued for example when the keyboard layout is switched. It was added in sway-1.2. swaymsg command for reference:
swaymsg --type subscribe --monitor --raw '["input"]'