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: spm_eeg_inv_mesh.m
    path of file: ./repos/spm12
    
    the code of the file until where you have to start completion: function mesh = spm_eeg_inv_mesh(sMRI, Msize)
% Apply the inverse spatial deformation to the template mesh
% to obtain the individual cortical mesh
% save the individual GIFTI meshes
%
% FORMAT mesh = spm_eeg_inv_mesh(sMRI, Msize)
% Input:
%   sMRI - name of the sMRI file
%   Msize - size of the mesh (1-3)
% Output:
%   mesh   - inverse - normalized canonical mesh
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

% Jeremie Mattout & Christophe Phillips
% $Id: spm_eeg_inv_mesh.m 6682 2016-01-15 15:52:00Z vladimir $


% SPM directory of canonical anatomy
%--------------------------------------------------------------------------
Cdir              = fullfile(spm('dir'), 'canonical');

if nargin == 0 || isempty(sMRI)
    % Use the template
    %----------------------------------------------------------------------
    mesh.template = true;
    mesh.Affine   = eye(4);
    mesh.sMRI     = fullfile(Cdir, 'single_subj_T1.nii');
else

    
function mesh = spm_eeg_inv_mesh(sMRI, Msize)
% Apply the inverse spatial deformation to the template mesh
% to obtain the individual cortical mesh
% save the individual GIFTI meshes
%
% FORMAT mesh = spm_eeg_inv_mesh(sMRI, Msize)
% Input:
%   sMRI - name of the sMRI file
%   Msize - size of the mesh (1-3)
% Output:
%   mesh   - inverse - normalized canonical mesh
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

% Jeremie Mattout & Christophe Phillips
% $Id: spm_eeg_inv_mesh.m 6682 2016-01-15 15:52:00Z vladimir $


% SPM directory of canonical anatomy
%--------------------------------------------------------------------------
Cdir              = fullfile(spm('dir'), 'canonical');

if nargin == 0 || isempty(sMRI)
    % Use the template
    %----------------------------------------------------------------------
    mesh.template = true;
    mesh.Affine   = eye(4);
    mesh.sMRI     = fullfile(Cdir, 'single_subj_T1.nii');
else
    mesh.template = false;
    mesh.sMRI     = sMRI;
    mesh          = spm_eeg_inv_spatnorm(mesh);
end