code: func (s *Reader) Chunk(ref uint64) (chunkenc.Chunk, error) {
  	var (
  		sgmSeq    = int(ref >> 32)
  		sgmOffset = int((ref << 32) >> 32)
  	)
  	if sgmSeq >= len(s.bs) {
  		return nil, errors.Errorf("reference sequence %d out of range", sgmSeq)
  	}
  	chkS := s.bs[sgmSeq]
  
  	if sgmOffset >= chkS.Len() {
  		return nil, errors.Errorf("offset %d beyond data size %d", sgmOffset, chkS.Len())
  	}
  	// With the minimum chunk length this should never cause us reading
  	// over the end of the slice.
  	chk := chkS.Range(sgmOffset, sgmOffset+binary.MaxVarintLen32)
  
  	chkLen, n := binary.Uvarint(chk)
  	if n <= 0 {
  		return nil, errors.Errorf("reading chunk length failed with %d", n)
  	}
  	chk = chkS.Range(sgmOffset+n, sgmOffset+n+1+int(chkLen))
  
  	return s.pool.Get(chunkenc.Encoding(chk[0]), chk[1:1+chkLen])
  }
docs: // Chunk returns a chunk from a given reference.