code: func NewCodec(
  	serializer runtime.Serializer,
  	convertor runtime.ObjectConvertor,
  	creater runtime.ObjectCreater,
  	copier runtime.ObjectCopier,
  	typer runtime.Typer,
  	encodeVersion []unversioned.GroupVersion,
  	decodeVersion []unversioned.GroupVersion,
  ) runtime.Codec {
  	internal := &codec{
  		serializer: serializer,
  		convertor:  convertor,
  		creater:    creater,
  		copier:     copier,
  		typer:      typer,
  	}
  	if encodeVersion != nil {
  		internal.encodeVersion = make(map[string]unversioned.GroupVersion)
  		for _, v := range encodeVersion {
  			// first one for a group wins.  This is consistent with best to worst order throughout the codebase
  			if _, ok := internal.encodeVersion[v.Group]; ok {
  				continue
  			}
  			internal.encodeVersion[v.Group] = v
  		}
  	}
  	if decodeVersion != nil {
  		internal.decodeVersion = make(map[string]unversioned.GroupVersion)
  		for _, v := range decodeVersion {
  			// first one for a group wins.  This is consistent with best to worst order throughout the codebase
  			if _, ok := internal.decodeVersion[v.Group]; ok {
  				continue
  			}
  			internal.decodeVersion[v.Group] = v
  		}
  	}
  
  	return internal
  }
docs: // NewCodec takes objects in their internal versions and converts them to external versions before
  // serializing them. It assumes the serializer provided to it only deals with external versions.
  // This class is also a serializer, but is generally used with a specific version.