You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: helpers.go
    path of file: ./repos/parca-agent/pkg/elfwriter
    
    the code of the file until where you have to start completion: // Copyright 2022-2024 The Parca Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package elfwriter

import (
	"debug/elf"
	"encoding/binary"
	"errors"
	"fmt"
	"io"
	"strings"

	"github.com/klauspost/compress/zlib"
)

type zeroReader struct{}

func (*zeroReader) ReadAt(p []byte, off int64) (_ int, _ error) {
	for i := range p {
		p[i] = 0
	}
	return len(p), nil
}

ty
    
func NewCompressionHeaderFromSource(fhdr *elf.FileHeader, src io.ReaderAt, offset int64) (*compressionHeader, error) {
	hdr := &compressionHeader{}

	switch fhdr.Class {
	case elf.ELFCLASS32:
		ch := new(elf.Chdr32)
		hdr.headerSize = binary.Size(ch)
		sr := io.NewSectionReader(src, offset, int64(hdr.headerSize))
		if err := binary.Read(sr, fhdr.ByteOrder, ch); err != nil {
			return nil, err
		}
		hdr.class = elf.ELFCLASS32
		hdr.Type = ch.Type
		hdr.Size = uint64(ch.Size)
		hdr.Addralign = uint64(ch.Addralign)
		hdr.byteOrder = fhdr.ByteOrder
	case elf.ELFCLASS64:
		ch := new(elf.Chdr64)
		hdr.headerSize = binary.Size(ch)
		sr := io.NewSectionReader(src, offset, int64(hdr.headerSize))
		if err := binary.Read(sr, fhdr.ByteOrder, ch); err != nil {
			return nil, err
		}
		hdr.class = elf.ELFCLASS64
		hdr.Type = ch.Type
		hdr.Size = ch.Size
		hdr.Addralign = ch.Addralign
		hdr.byteOrder = fhdr.ByteOrder
	case elf.ELFCLASSNONE:
		fallthrough
	default:
		return nil, fmt.Errorf("unknown ELF class: %v", fhdr.Class)
	}

	if elf.CompressionType(hdr.Type) != elf.COMPRESS_ZLIB {
		// TODO(kakkoyun): COMPRESS_ZSTD
		// https://github.com/golang/go/issues/55107
		return nil, errors.New("section should be zlib compressed, we are reading from the wrong offset or debug data is corrupt")
	}

	return hdr, nil
}