code: def add_message(request, level, message, extra_tags='', fail_silently=False):
      
      if not horizon_message_already_queued(request, message):
          if request.is_ajax():
              tag = constants.DEFAULT_TAGS[level]
              # if message is marked as safe, pass "safe" tag as extra_tags so
              # that client can skip HTML escape for the message when rendering
              if isinstance(message, SafeData):
                  extra_tags = extra_tags + ' safe'
              request.horizon['async_messages'].append([tag,
                                                        force_text(message),
                                                        extra_tags])
          else:
              return _messages.add_message(request, level, message,
                                           extra_tags, fail_silently)
docs: Attempts to add a message to the request using the 'messages' app.