docs: public static AttachmentSummary matchByLocale(Collection<? extends AttachmentSummary> attachments,
                                                    AttachmentType desiredType, Locale desiredLocale) {
          Collection<AttachmentSummary> possibleMatches = new ArrayList<AttachmentSummary>();
          for (AttachmentSummary s : attachments) {
              AttachmentType attType = s.getAttachment().getType();
  
              if (attType.equals(desiredType)) {
                  // This is either an exact match, or a candidate for a match-by-language
                  if (s.getLocale().equals(desiredLocale)) {
                      return s;
                  } else {
                      possibleMatches.add(s);
                  }
              }
          }
  
          Locale baseDesiredLocale = new Locale(desiredLocale.getLanguage());
          for (AttachmentSummary s : possibleMatches) {
              if (s.getLocale().equals(baseDesiredLocale)) {
                  return s;
              }
          }
  
          // If we've found no better match, can we at least provide English?
          for (AttachmentSummary s : possibleMatches) {
              if (s.getLocale().equals(Locale.ENGLISH)) {
                  return s;
              }
          }
  
          // Getting desperate: do we have anything that's language is English?
          for (AttachmentSummary s : possibleMatches) {
              if (new Locale(s.getLocale().getLanguage()).equals(Locale.ENGLISH)) {
                  return s;
              }
          }
  
          return null;
      }