<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cleanUpPparse(outputpath, rawfilename, mgf=False):
 """Delete temporary files generated by pparse, including the filetypes ".csv", ".ms1", ".ms2", ".xtract", the files "pParsePlusLog.txt" and "pParse.para" and optionally also the ".mgf" file generated by pParse. .. warning: When the parameter "mgf" is set to "True" all files ending with ".mgf" and containing the specified "filename" are deleted. This could potentially also affect MGF files not generated by pParse. :param outputpath: path to the output directory of pParse :param rawfilename: filename of the thermo ".raw" file :param mgf: bool, if True the ".mgf" file generated by pParse is also removed """

    extensions = ['csv', 'ms1', 'ms2', 'xtract']
    filename, fileext = os.path.splitext(os.path.basename(rawfilename))
    additionalFiles = [aux.joinpath(outputpath, 'pParsePlusLog.txt'),
                       aux.joinpath(outputpath, filename+'.pparse.para'),
                       ]

    for ext in extensions:
        filepath = aux.joinpath(outputpath, '.'.join([filename, ext]))
        if os.path.isfile(filepath):
            print('Removing file: ', filepath)
            os.remove(filepath)
    for filepath in additionalFiles:
        if os.path.isfile(filepath):
            print('Removing file: ', filepath)
            os.remove(filepath)
    if mgf:
        for _filename in os.listdir(outputpath):
            _basename, _fileext = os.path.splitext(_filename)
            if _fileext.lower() != '.mgf':
                continue
            if _basename.find(basename) != -1 and _basename != basename:
                filepath = aux.joinpath(outputpath, _filename)
                print('Removing file: ', filepath)
                os.remove(filepath)