This is old code I've done in a previous life, I recommend to use https://github.com/erezsh/lark instead.