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: yaml.go
    path of file: ./repos/cosmos-sdk/codec
    
    the code of the file until where you have to start completion: package codec

import (
	"github.com/cosmos/gogoproto/proto"
	"sigs.k8s.io/yaml"
)

// MarshalYAML marshals toPrint using JSONCodec to leverage specialized MarshalJSON methods
// (usually related to serialize data with protobuf or amin depending on a configuration).
// This involve
    
func MarshalYAML(cdc JSONCodec, toPrint proto.Message) ([]byte, error) {
	// We are OK with the performance hit of the additional JSON roundtip. MarshalYAML is not
	// used in any critical parts of the system.
	bz, err := cdc.MarshalJSON(toPrint)
	if err != nil {
		return nil, err
	}

	return yaml.JSONToYAML(bz)
}