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: eval_3d_nurbs_derk.m
    path of file: ./repos/Isogeometric-Analysis/routines_for_iga
    
    the code of the file until where you have to start completion: %--------------------------------------------------------------------------
%  Author: Isaac J. Lee (ijlee2@ices.utexas.edu)
%  
%  
%  Summary:
%  
%  This routine computes the derivatives of 3D NURBS with respect to the
%  parametric domain (up to the k-th partial derivative) at the given
%  locations (e.g. at the quadrature points).
%  
%  
%  Warning:
%  
%  We must first evaluate the 3D B-splines with respect to the parametric
%  domain. (Evaluate the univariate B-splines using build_bezier_extraction
%  and ev
    
function code = code_to_generate_coefficients(k1, k2, k3)
    k = k1 + k2 + k3;
    
    code = sprintf('NURBS_der%d%d%d(:, j) = sum000_inv(j) * (Bspline_der%d%d%d(:, j)', k1, k2, k3, k1, k2, k3);
    
    for j3 = 0 : min(k - 1, k3)
        for j2 = 0 : min(k - 1 - j3, k2)
            for j1 = 0 : min(k - 1 - j3 - j2, k1)
                coefficient = nchoosek(k1, j1) * nchoosek(k2, j2) * nchoosek(k3, j3);
                
                if (coefficient == 1)
                    if (j1 == 0 && j2 == 0 && j3 == 0)
                        code = sprintf('%s - sum%d%d%d(j) * NURBS_der%d%d%d(:, j)', code, k1 - j1, k2 - j2, k3 - j3, j1, j2, j3);
                    else
                        code = sprintf('%s -     sum%d%d%d(j) * NURBS_der%d%d%d(:, j)', code, k1 - j1, k2 - j2, k3 - j3, j1, j2, j3);
                    end