Help with logic filtering of message

Because scanning one message for substrings is just too complicated for me.

I get the messages and save them as contexts, so it gets the messages, stores them and then acts on what the contexts are.

I also think I goofed with the line:

msg.payload = context.get('TimePi_message');

And it should be:

msg = context.get('TimePi_message');

Because the entire message is stored. Not just the message.