<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def attach(self, listener):
 """Attach an object that should be notified of events. The object should have a notify(msg_type, param_dict) function. """

        if listener not in self.listeners:
            self.listeners.append(listener)