code: func WriteBytes(buf io.ByteWriter, data []byte) (n int, err error) {
  	wb := func(b byte) (err error) {
  		if err = buf.WriteByte(b); err == nil {
  			n++
  		}
  		return
  	}
  
  	acc := byte(0)
  	for i := 0; i < len(data); i++ {
  		m := uint(i % 7)
  		b := data[i]
  		if err = wb(acc | 1 | ((b & (0xff << (m + 1))) >> m)); err != nil {
  			return
  		}
  		acc = (b << (7 - m))
  		if m == 6 {
  			if err = wb(acc | 1); err != nil {
  				return
  			}
  			acc = 0
  		}
  	}
  	err = wb(acc)
  	return
  }
docs: // WriteBytes writes an encoded []byte to buf, returning the number of bytes
  // written, and any write error encountered.