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: parse_varargin_NDI.m
    path of file: ./repos/sepia/wrapper/parser/deprecated
    
    the code of the file until where you have to start completion: %% function [tolerance,stepSize,iteration,weight,b0dir] = parse_varargin_NDI(arg)
%
% Description: parser for NDI.m
%
% Kwok-shing Chan @ DCCN
% k.chan@donders.ru.nl
% Date created: 5 June 2019
% Date last modified: 27 Feb 2020 (v0.8.0)
%
function [tolerance,stepSize,iteration,weight,b0dir,isGPU] = parse_varargin_NDI(arg)

% predefine parameters
tolerance   = 1;
stepSize    = 1;
iteration   = 200;
b0dir       = [0,0,1];
weight      = [];
isGPU       = false
    
function [tolerance,stepSize,iteration,weight,b0dir] = parse_varargin_NDI(arg)
%
% Description: parser for NDI.m
%
% Kwok-shing Chan @ DCCN
% k.chan@donders.ru.nl
% Date created: 5 June 2019
% Date last modified: 27 Feb 2020 (v0.8.0)
%
function [tolerance,stepSize,iteration,weight,b0dir,isGPU] = parse_varargin_NDI(arg)

% predefine parameters
tolerance   = 1;
stepSize    = 1;
iteration   = 200;
b0dir       = [0,0,1];
weight      = [];
isGPU       = false;

% use user defined input if any
if ~isempty(arg)
    for kvar = 1:length(arg)
        if strcmpi(arg{kvar},'tol')
            tolerance = arg{kvar+1};
        end