Python program that capture data and decode it

Hello guys,
I found a python program on internet that is supposed to capture lora data and decode it using mqtt :

My coding skills are not good
The problem is it was supposed to be working before the mqtt topics path updates.
And in the code, when I replace “gateway/aa555a0000000101/rx” with the appropriate one “gateway/aa555a0000000101/event/up”, it does not detect any payload even tho it works when I write it as a command line.

I think that this program could really simplify all those capture and decoding part so if someone know how to make it work, that’s be awesome.

Sorry btw for my english, and I hope I was clear.