docs: def check_messages(filename, report_empty=False):
      """
      Checks messages in `filename` in various ways:
  
      * Translations must have the same slots as the English.
  
      * Messages can't have astral characters in them.
  
      If `report_empty` is True, will also report empty translation strings.
  
      Returns the problems, a list of tuples. Each is a description, a msgid, and
      then zero or more translations.
  
      """
      problems = []
      pomsgs = polib.pofile(filename)
      for msg in pomsgs:
          # Check for characters Javascript can't support.
          # https://code.djangoproject.com/ticket/21725
          if astral(msg.msgstr):
              problems.append(("Non-BMP char", msg.msgid, msg.msgstr))
  
          if is_format_message(msg):
              # LONG_DATE_FORMAT, etc, have %s etc in them, and that's ok.
              continue
  
          if msg.msgid_plural:
              # Plurals: two strings in, N strings out.
              source = msg.msgid + " | " + msg.msgid_plural
              translation = " | ".join(v for k, v in sorted(msg.msgstr_plural.items()))
              empty = any(not t.strip() for t in msg.msgstr_plural.values())
          else:
              # Singular: just one string in and one string out.
              source = msg.msgid
              translation = msg.msgstr
              empty = not msg.msgstr.strip()
  
          if empty:
              if report_empty:
                  problems.append(("Empty translation", source))
          else:
              id_tags = tags_in_string(source)
              tx_tags = tags_in_string(translation)
  
              # Check if tags don't match
              if id_tags != tx_tags:
                  id_has = u", ".join(sorted(u'"{}"'.format(t) for t in id_tags - tx_tags))
                  tx_has = u", ".join(sorted(u'"{}"'.format(t) for t in tx_tags - id_tags))
                  if id_has and tx_has:
                      diff = u"{} vs {}".format(id_has, tx_has)
                  elif id_has:
                      diff = u"{} missing".format(id_has)
                  else:
                      diff = u"{} added".format(tx_has)
                  problems.append((
                      "Different tags in source and translation",
                      source,
                      translation,
                      diff
                  ))
  
      return problems