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: key_wrap.go
    path of file: ./repos/plumber/vendor/github.com/dvsekhvalnov/jose2go/aes
    
    the code of the file until where you have to start completion: package aes

import (
	"github.com/dvsekhvalnov/jose2go/arrays"
	"crypto/cipher"
	"crypto/aes"
	"crypto/hmac"
	"errors"
)

var	defaultIV=[]byte { 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6 }

// KeyWrap encrypts provided key (CEK) with KEK key using AES Key Wrap (rfc 3394) algorithm
func KeyWrap(cek,kek []byte) ([]byte,error) {
	// 1) Initialize variables
    a := defaultIV              // Set A = IV, an initial value
    r := arrays.Slice(cek, 8)   // For i = 1 to n
								//     R[0][i] = P[i]
	n := uint64(len(r))
	
    // 2) Calculate intermediate values.
	var j,i,t uint64
	
	for j = 0; j < 6; j++ {                              // For j = 0 to 5
		for i = 0; i < n; i++ {                          //    F
    
func KeyWrap(cek,kek []byte) ([]byte,error) {
	// 1) Initialize variables
    a := defaultIV              // Set A = IV, an initial value
    r := arrays.Slice(cek, 8)   // For i = 1 to n
								//     R[0][i] = P[i]
	n := uint64(len(r))
	
    // 2) Calculate intermediate values.
	var j,i,t uint64
	
	for j = 0; j < 6; j++ {                              // For j = 0 to 5
		for i = 0; i < n; i++ {                          //    For i=1 to n
			t = n * j + i + 1;
			b,e := aesEnc(kek, arrays.Concat(a, r[i]))   //       B=AES(K, A | R[i])
			
			if e!=nil { return nil, e }
			
			a = b[:len(b)/2]   							 //       A=MSB(64,B) ^ t where t = (n*j)+i
			r[i] = b[len(b)/2:]             			 //       R[i] = LSB(64, B)
			a = arrays.Xor(a, arrays.UInt64ToBytes(t))
		}
	}
	
	// 3) Output the results
	c := make([][]byte, n+1, n+1)
	c[0] = a;                              //  Set C[0] = A
	for i = 1; i <= n; i++ {               //  For i = 1 to n
		c[i] = r[i - 1]                    //     C[i] = R[i]
	}                      

	return arrays.Unwrap(c),nil
}