code: func readLPBytes(buf []byte, safe bool, t Type) ([]byte, int, error) {
  	if len(buf) < 2 {
  		return nil, 0, makeError(t, "insufficient buffer size, expected 2, got %d", len(buf))
  	}
  
  	n, total := 0, 0
  
  	n = int(binary.BigEndian.Uint16(buf))
  	total += 2
  	total += n
  
  	if len(buf) < total {
  		return nil, total, makeError(t, "insufficient buffer size, expected %d, got %d", total, len(buf))
  	}
  
  	// copy buffer in safe mode
  	if safe {
  		newBuf := make([]byte, total-2)
  		copy(newBuf, buf[2:total])
  		return newBuf, total, nil
  	}
  
  	return buf[2:total], total, nil
  }
docs: // read length prefixed bytes