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: transform_email.go
    path of file: ./repos/neosync/worker/internal/benthos/transformers
    
    the code of the file until where you have to start completion: package transformers

import (
	"fmt"
	"strings"

	"github.com/benthosdev/benthos/v4/public/bloblang"
	transformer_utils "github.com/nucleuscloud/neosync/worker/internal/benthos/transformers/utils"
)

func init() {
	spec := bloblang.NewPluginSpec().
		Param(bloblang.NewAnyParam("email").Optional()).
		Param(bloblang.NewBoolParam("preserve_length")).
		Param(bloblang.NewBoolParam("preserve_domain")).
		Param(bloblang.NewAnyParam("excluded_domains")).
		Param(bloblang.NewInt64Param("max_length"))

	err := bloblang.RegisterFunctionV2("transform_email", spe
    
func TransformEmailPreserveLength(email string, excludeList []string) (string, error) {
	var res string

	parsedEmail, err := transformer_utils.ParseEmail(email)
	if err != nil {
		return "", fmt.Errorf("invalid email: %s", email)
	}

	// generate a random username for the email address
	un, err := transformer_utils.GenerateRandomStringWithDefinedLength(int64(len(parsedEmail[0])))
	if err != nil {
		return "", nil
	}

	// split the domain to account for different domain name lengths
	splitDomain := strings.Split(parsedEmail[1], ".")

	var domain string

	// handle exclusion list
	if transformer_utils.StringInSlice(parsedEmail[1], excludeList) {
		domain = parsedEmail[1]
	} else {
		// generate a random domain
		dom, err := transformer_utils.GenerateRandomStringWithDefinedLength(int64(len(splitDomain[0])))
		if err != nil {
			return "", nil
		}

		// generate a random top level domain
		tld, err := transformer_utils.GenerateRandomStringWithDefinedLength(int64(len(splitDomain[1])))
		if err != nil {
			return "", nil
		}
		domain = dom + "." + tld
	}

	res = transformer_utils.SliceString(un, len(parsedEmail[0])) + "@" + domain

	return res, err
}