You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: backend_taskStage_taskResults.go
    path of file: ./repos/terraform/internal/cloud
    
    the code of the file until where you have to start completion: // Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1

package cloud

import (
	"fmt"
	"strings"

	"github.com/hashicorp/go-tfe"
)

type taskResultSummary struct {
	unreachable     bool
	pending         int
	failed          int
	failedMandatory int
	passed          int
}

type taskResultSummarizer struct {
	finished bool
	cloud    *Cloud
	counter  int
}

func newTaskResultSummarizer(b *Cloud, ts *tfe.TaskStage) taskStageSummarizer {
	if len(ts.TaskResults) == 0 {
		return nil
	}
	return &taskResultSummarizer{
		finished: false,
		cloud:    b,
	}
}

func (trs *taskResultSummarizer) Summarize(
    
func (trs *taskResultSummarizer) Summarize(context *IntegrationContext, output IntegrationOutputWriter, ts *tfe.TaskStage) (bool, *string, error) {
	if trs.finished {
		return false, nil, nil
	}
	trs.counter++

	counts := summarizeTaskResults(ts.TaskResults)

	if counts.pending != 0 {
		pendingMessage := "%d tasks still pending, %d passed, %d failed ... "
		message := fmt.Sprintf(pendingMessage, counts.pending, counts.passed, counts.failed)
		return true, &message, nil
	}
	if counts.unreachable {
		output.Output("Skipping task results.")
		output.End()
		return false, nil, nil
	}

	// Print out the summary
	trs.runTasksWithTaskResults(output, ts.TaskResults, counts)

	// Mark as finished
	trs.finished = true

	return false, nil, nil
}