code: func (tag *Tag) WriteTo(w io.Writer) (n int64, err error) {
  	if w == nil {
  		return 0, errors.New("w is nil")
  	}
  
  	// Count size of frames.
  	framesSize := tag.Size() - tagHeaderSize
  	if framesSize <= 0 {
  		return 0, nil
  	}
  
  	// Write tag header.
  	bw := getBufWriter(w)
  	defer putBufWriter(bw)
  	writeTagHeader(bw, uint(framesSize), tag.version)
  
  	// Write frames.
  	synchSafe := tag.Version() == 4
  	err = tag.iterateOverAllFrames(func(id string, f Framer) error {
  		return writeFrame(bw, id, f, synchSafe)
  	})
  	if err != nil {
  		bw.Flush()
  		return bw.Written(), err
  	}
  
  	return bw.Written(), bw.Flush()
  }
docs: // WriteTo writes whole tag in w if there is at least one frame.
  // It returns the number of bytes written and error during the write.
  // It returns nil as error if the write was successful.