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: getargs.m
    path of file: ./repos/MCITF/Code/MCITF/EdgeBox/piotr_toolbox/toolbox/external/deprecated
    
    the code of the file until where you have to start completion: % Utility to process parameter name/value pairs.
%
% DEPRECATED -- ONLY USED BY KMEANS2?  SHOULD BE REMOVED.
% USE GETPARAMDEFAULTS INSTEAD.
%
% Based on code fromt Matlab Statistics Toolobox's "private/statgetargs.m"
%
% [EMSG,A,B,...]=GETARGS(PNAMES,DFLTS,'NAME1',VAL1,'NAME2',VAL2,...)
% accepts a cell array PNAMES of valid parameter names, a cell array DFLTS
% of defaul
    
function [emsg,varargout]=getargs(pnames,dflts,varargin)

wid = sprintf('Images:%s:obsoleteFunction',mfilename);
warning(wid,[ '%s is obsolete in Piotr''s toolbox.\n It will be ' ...
  'removed in the next version of the toolbox.'],upper(mfilename));

% We always create (nparams+1) outputs:
%    one for emsg
%    nparams varargs for values corresponding to names in pnames
% If they ask for one more (nargout == nparams+2), it's for unrecognized
% names/values
emsg = '';
nparams = length(pnames);
varargout = dflts;
unrecog = {};
nargs = length(varargin);

% Must have name/value pairs
if mod(nargs,2)~=0
  emsg = sprintf('Wrong number of arguments.');
else
  % Process name/value pairs
  for j=1:2:nargs
    pname = varargin{j};
    if ~ischar(pname)
      emsg = sprintf('Parameter name must be text.');
      break;
    end