docs: function preFinaliseBatch(batch, context) {
    const task = this;
  
    // Look up the actual function to be used to do the pre-finalise batch logic (if any)
    const preFinaliseBatchFn = Settings.getPreFinaliseBatchFunction(context);
  
    if (!preFinaliseBatchFn) {
      if (context.traceEnabled) context.trace(`Skipping pre-finalise of ${batch.describe(false)}, since no preFinaliseBatch function configured`);
      return Promise.resolve(undefined);
    }
  
    // Create a task to be used to execute and track the configured preFinaliseBatch function
    const fnName = isNotBlank(preFinaliseBatchFn.name) ? preFinaliseBatchFn.name : 'preFinaliseBatch';
    const preFinaliseBatchTask = task.createSubTask(fnName, preFinaliseBatchFn, batchSettings, processTaskOpts);
  
    // Pre-finalise the batch
    const p = preFinaliseBatchTask.execute(batch, context);
    return whenDone(preFinaliseBatchTask, p, undefined, context).then(
      () => {
        if (context.traceEnabled) context.trace(`Pre-finalised ${batch.describe(false)}`);
        return batch;
      },
      err => {
        context.error(`Failed to pre-finalise ${batch.describe(false)}`, err);
        throw err;
      }
    );
  }