<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def writeTraj(filename='trajectory.input', data=[], ageunit=0, tunit=0,
              rhounit=0, idNum=0):
    '''
    Method for writeing Trajectory type ascii files files.

    Parameters
    ----------
    filename : string
        The file where this data will be written.
    data : list
        A list of 1D data vectors with time, T and rho.
    ageunit : integer, optional
        If 1 ageunit = SEC, If 0 ageunit = YRS. If 2 agunit =
        logtimerev in yrs.  The default is 0.  logtimerev is log of
        time until end
    tunit : integer, optional
        If 1 TUNIT  = T9K, if 0 TUNIT = T8K.  The default is 0.
    rhounit : integer, optional
        If 1 RHOUNIT = LOG, if 0 RHOUNIT = CGS. The default is 0.
    idNum : optional
        An optional id argument

    '''
    if data==[]:
        print('Please input correct data')
        print('returning None')
        return None
    headers=[]
    if ageunit ==1:
        headers.append('AGEUNIT = SEC')
    elif ageunit==0:
        headers.append('AGEUNIT = YRS')
    elif ageunit==2:
        headers.append('AGEUNIT = logtimerev/yrs')

    if tunit ==1:
        headers.append('TUNIT   = T9K')
    elif tunit==0:
        headers.append('TUNIT   = T8K')

    if rhounit ==1:
        headers.append('RHOUNIT = LOG')
    elif rhounit==0:
        headers.append('RHOUNIT = CGS')

    headers.append('ID = '+str(idNum))

    write(filename,headers,['time','T','rho'],data,['YRS/SEC; T8K/T9K; CGS/LOG',"FORMAT: '(10x,A3)'"],trajectory=True)