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: xfieldmask.go
    path of file: ./repos/jupiter/pkg/util/xfieldmask
    
    the code of the file until where you have to start completion: package xfieldmask

import (
	"strings"

	"google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/reflect/protoreflect"
)

// NestedFieldMask helps to build a nested field mask.
type NestedFieldMask map[string]NestedFieldMask

type MaskMode uint32

const (
	// FiledMaskMode_Filter indicates that the only fields in fieldmask should be kept.
	MaskMode_Filter MaskMode = 0
	// FiledMaskM
    
func (mask NestedFieldMask) Filter(m proto.Message) {
	if len(mask) == 0 {
		return
	}

	pr := m.ProtoReflect()
	pr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {
		if string(fd.Name()) == "error" || string(fd.Name()) == "msg" {
			return true
		}
		nfm, ok := mask[string(fd.Name())]
		if !ok {
			pr.Clear(fd)
			return true
		}

		if len(nfm) == 0 {
			return true
		}

		// repeated field type
		if fd.IsList() && fd.Kind() == protoreflect.MessageKind {
			l := pr.Get(fd).List()
			for i := 0; i < l.Len(); i++ {
				nfm.Filter(l.Get(i).Message().Interface())
			}
			return true
		}

		if fd.Kind() == protoreflect.MessageKind {
			nfm.Filter(pr.Get(fd).Message().Interface())
		}

		return true
	})
}