private void importLabelsForMessages(
      TokensAndUrlAuthData authData,
      IdempotentImportExecutor idempotentExecutor,
      Supplier<Map<String, String>> allDestinationLabels,
      Collection<MailMessageModel> messages) throws Exception {
    for (MailMessageModel mailMessageModel : messages) {
      // Get or create label ids associated with this message
      for (String exportedLabelName : mailMessageModel.getContainerIds()) {
        idempotentExecutor.executeAndSwallowIOExceptions(
            exportedLabelName,
            exportedLabelName,
            () -> {
              String importerLabelId = allDestinationLabels.get().get(exportedLabelName);
              // Found no existing map or label named the same, create a new one
              if (importerLabelId == null) {
                  importerLabelId = createImportedLabelId(authData, exportedLabelName);
              }
              return importerLabelId;
            });
      }
    }
  }
Creates a label in the import account, if it doesn't already exist, for all labels associated
with the give {@code messages} .
extensions/data-transfer/portability-data-transfer-google/src/main/java/org/datatransferproject/datatransfer/google/mail/GoogleMailImporter.java