code: def attach(self, listener):
          
          if listener not in self.listeners:
              self.listeners.append(listener)
docs: Attach an object that should be notified of events.
  
          The object should have a notify(msg_type, param_dict) function.