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: encoder.go
    path of file: ./repos/go-gin-example/vendor/github.com/boombuler/barcode/qr
    
    the code of the file until where you have to start completion: // Package qr can be used to create QR barcodes.
package qr

import (
	"image"

	"github.com/boombuler/barcode"
	"github.com/boombuler/barcode/utils"

    
func Encode(content string, level ErrorCorrectionLevel, mode Encoding) (barcode.Barcode, error) {
	bits, vi, err := mode.getEncoder()(content, level)
	if err != nil {
		return nil, err
	}

	blocks := splitToBlocks(bits.IterateBytes(), vi)
	data := blocks.interleave(vi)
	result := render(data, vi)
	result.content = content
	return result, nil
}