docs: def _save_message(self, stack, type_, message, context=None,
                        from_merge=False):
          'Stores a message in the appropriate message stack.'
  
          uid = uuid.uuid4().hex
          message['uid'] = uid
  
          # Get the context for the message (if there's a context available)
          if context is not None:
              if isinstance(context, tuple):
                  message['context'] = context
              else:
                  message['context'] = (
                      context.get_context(line=message['line'],
                                          column=message['column']))
          else:
              message['context'] = None
  
          if self.package_stack:
              if not isinstance(message['file'], list):
                  message['file'] = [message['file']]
  
              message['file'] = self.package_stack + message['file']
  
          # Test that if for_appversions is set that we're only applying to
          # supported add-ons. THIS IS THE LAST FILTER BEFORE THE MESSAGE IS
          # ADDED TO THE STACK!
          if message['for_appversions']:
              if not self.supports_version(message['for_appversions']):
                  if self.instant:
                      print '(Instant error discarded)'
                      self._print_message(type_, message, verbose=True)
                  return
          elif self.version_requirements:
              # If there was no for_appversions but there were version
              # requirements detailed in the decorator, use the ones from the
              # decorator.
              message['for_appversions'] = self.version_requirements
  
          # Save the message to the stack.
          stack.append(message)
  
          # Mark the tier that the error occurred at.
          if message['tier'] is None:
              message['tier'] = self.tier
  
          # Build out the compatibility summary if possible.
          if message['compatibility_type'] and not from_merge:
              self.compat_summary['%ss' % message['compatibility_type']] += 1
  
          # Build out the message tree entry.
          if message['id']:
              tree = self.message_tree
              last_id = None
              for eid in message['id']:
                  if last_id is not None:
                      tree = tree[last_id]
                  if eid not in tree:
                      tree[eid] = {'__errors': 0,
                                   '__warnings': 0,
                                   '__notices': 0,
                                   '__messages': []}
                  tree[eid]['__%s' % type_] += 1
                  last_id = eid
  
              tree[last_id]['__messages'].append(uid)
  
          # If instant mode is turned on, output the message immediately.
          if self.instant:
              self._print_message(type_, message, verbose=True)