code: function configureStage(context, event, awsContext, failFast) {
    if (!context.stage) {
      const stage = resolveStage(event, awsContext, context);
      if (isBlank(stage)) {
        const errorMsg = `Failed to resolve stage from event (${JSON.stringify(event)}) and awsContext (${JSON.stringify(awsContext)}) - consider configuring a fallback stage on context.defaultStage (or on context.stageHandling.defaultStage via configureStageHandling); or, less preferable, on context.stage (as a complete override)`;
        // If failFast is explicitly true, then log and raise this error
        if (failFast === true) {
          context.error(errorMsg);
          throw new Error(errorMsg);
        }
        // Otherwise log the error as a warning and set context.stage to an empty string
        context.warn(errorMsg);
        context.stage = '';
      } else {
        // Resolved a non-blank stage!
        context.stage = stage;
      }
    }
    context.info(`Using stage (${context.stage})`);
    return context;
  }
docs: Returns context.stage from the given context if it is already defined; otherwise attempts to resolve the stage and
  then, if non-blank, configure the stage on the given context (as context.stage); otherwise either raises an error
  (if failFast is explicitly true) or logs a warning.
  @param {StageHandling|StageAware|Object} context - a context with stage handling settings and logging functionality
  on which to set the stage
  @param {Object} event - the AWS event
  @param {Object} awsContext - the AWS context, which was passed to your lambda
  @param {boolean|undefined} [failFast] - an optional failFast flag, which is only used when a needed resolved stage is
  blank and which determines whether the error will be raised (if failFast is explicitly true) or logged as a warning
  @returns {StageAware} the given context with its existing stage or the resolved stage or an empty string stage.
  @throws {Error} if failFast is explicitly true and a needed resolved stage is blank