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: aas_fileparts.m
    path of file: ./repos/automaticanalysis/aa_engine
    
    the code of the file until where you have to start completion: % Like matlab fileparts, except that '.nii.gz' counts as a single extension
function [pth 
    
function [pth nme ext]=aas_fileparts(fullpth)

[pth nme ext]=fileparts(deblank(fullpth));

if ~isempty(nme)
    [pth2 nme2 ext2]=fileparts(nme);

    if strcmp(ext2,'.nii') && strcmp(ext,'.gz')
        nme=nme2;
        ext=[ext2 ext];
    end