def add_listener(self, listener, message_type, data=None, one_shot=False):
lst = self._one_shots if one_shot else self._listeners<EOL>if message_type not in lst:<EOL><INDENT>lst[message_type] = []<EOL><DEDENT>lst[message_type].append(Listener(listener, data))<EOL>
Add a listener that will receice incoming messages.