code: func writeLPBytes(buf []byte, b []byte, t Type) (int, error) {
  	total, n := 0, len(b)
  
  	if n > int(maxLPLength) {
  		return 0, makeError(t, "length (%d) greater than %d bytes", n, maxLPLength)
  	}
  
  	if len(buf) < 2+n {
  		return 0, makeError(t, "insufficient buffer size, expected %d, got %d", 2+n, len(buf))
  	}
  
  	binary.BigEndian.PutUint16(buf, uint16(n))
  	total += 2
  
  	copy(buf[total:], b)
  	total += n
  
  	return total, nil
  }
docs: // write length prefixed bytes