docs: private FailedBatch doBatchWriteItemWithRetry(
              Map<String, List<WriteRequest>> batch,
              BatchWriteRetryStrategy batchWriteRetryStrategy) {
  
          BatchWriteItemResult result = null;
          int retries = 0;
          int maxRetries = batchWriteRetryStrategy
                  .getMaxRetryOnUnprocessedItems(Collections
                          .unmodifiableMap(batch));
  
          FailedBatch failedBatch = null;
          Map<String, List<WriteRequest>> pendingItems = batch;
  
          while (true) {
              try {
                  result = db.batchWriteItem(applyBatchOperationUserAgent(
                          new BatchWriteItemRequest().withRequestItems(pendingItems)));
              } catch (Exception e) {
                  failedBatch = new FailedBatch();
                  failedBatch.setUnprocessedItems(pendingItems);
                  failedBatch.setException(e);
                  return failedBatch;
              }
              pendingItems = result.getUnprocessedItems();
  
              if (pendingItems.size() > 0) {
  
                  // return pendingItems as a FailedBatch if we have exceeded max retry
                  if (maxRetries >= 0 && retries >= maxRetries) {
                      failedBatch = new FailedBatch();
                      failedBatch.setUnprocessedItems(pendingItems);
                      failedBatch.setException(null);
                      return failedBatch;
                  }
  
                  pause(batchWriteRetryStrategy.getDelayBeforeRetryUnprocessedItems(
                          Collections.unmodifiableMap(pendingItems), retries));
                  retries++;
              } else {
                  break;
              }
          }
          return failedBatch;
      }