code: def add_message(self, text, type=None):
          
          key = self._msg_key
          self.setdefault(key, [])
          self[key].append(message(type, text))
          self.save()
docs: Add a message with an optional type.