code: func (s *Scheduler) waitFor(ctx context.Context, op stackOperation, ss twelvefactor.StatusStream) func(*cloudformation.DescribeStacksInput) error {
  	waiter := waiters[op]
  	wait := waiter.wait(s.cloudformation)
  
  	return func(input *cloudformation.DescribeStacksInput) error {
  		tags := []string{
  			fmt.Sprintf("stack:%s", *input.StackName),
  		}
  		publish(ctx, ss, waiter.startMessage)
  		start := time.Now()
  		err := wait(input)
  		stats.Timing(ctx, fmt.Sprintf("scheduler.cloudformation.%s", op), time.Since(start), 1.0, tags)
  		if err == nil {
  			publish(ctx, ss, waiter.successMessage)
  		}
  		return err
  	}
  }
docs: // waitFor returns a wait function that will wait for the given stack operation
  // to complete, and sends status messages to the status stream, and also records
  // metrics for how long the operation took.