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_add_special_session.m
    path of file: ./repos/automaticanalysis/aa_engine
    
    the code of the file until where you have to start completion: function [aap]=aas_add_special_session(aap,name)
% Add a special session (e.g. ASL, MPM, MTI), which are not explicitly defined, to the analysis. These acquisitions are typically conducted once per subject, hence they are not really multiple sessions (of the same acquisition).
% However, they are independent from each other and therfore can be analyzed in parallel. The function can be called multiple times to add more kinds or more of the same kind; however, the 'session' names must be unique in any 
% case. Example useage can be seen in aa_user_ASL, aa_user_MPM and aa_user_MTI.
%
% FORMAT function aap = aas_add_special_session(aap, name)
% This will add a new special session as specified in the name. Also, the input/output streams of the corresponding processing modules (aamod_get_dicom_specialseries and aamod_convert_specialseries) will be created to match the
% actual series. E.g.: aap=aas_add_special_session(aap,'ASL'); results in streams called dicom_ASL, ASL and ASL_dicom_header.
%
% aap           - aap structure with parameters and tasklist
% name       
    
function can be called multiple times to add more kinds or more of the same kind; however, the 'session' names must be unique in any 
% case. Example useage can be seen in aa_user_ASL, aa_user_MPM and aa_user_MTI.
%
% FORMAT function aap = aas_add_special_session(aap, name)
% This will add a new special session as specified in the name. Also, the input/output streams of the corresponding processing modules (aamod_get_dicom_specialseries and aamod_convert_specialseries) will be created to match the
% actual series. E.g.: aap=aas_add_special_session(aap,'ASL'); results in streams called dicom_ASL, ASL and ASL_dicom_header.
%
% aap           - aap structure with parameters and tasklist
% name          - name of the session for future reference

% Blank template for a session entry
thissess.name=name;

% And put into acq_details, replacing a single blank entry if it exists
firstsession = numel(aap.acq_details.special_sessions)==1 && isempty(aap.acq_details.special_sessions.name);
if firstsession
    aap.acq_details.special_sessions=thissess;
else
    doAdd = true;
    for iSess = 1:numel(aap.acq_details.special_sessions)
        if strcmp(aap.acq_details.special_sessions(iSess).name,thissess.name)
            doAdd = false;
        end