def write(self, fname, append=True):
mode = '<STR_LIT:w>'<EOL>if append and os.path.isfile(fname):<EOL><INDENT>mode = '<STR_LIT:a>'<EOL><DEDENT>header = '<STR_LIT>'.join(['<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>'])<EOL>print_str = "<STR_LIT>".format(<EOL>self.template_name, self.detect_time, self.no_chans,<EOL>self.chans, self.detect_val, self.threshold,<EOL>self.threshold_type, self.threshold_input, self.typeofdet)<EOL>with open(fname, mode) as _f:<EOL><INDENT>_f.write(header + '<STR_LIT:\n>')  <EOL>_f.write(print_str)<EOL><DEDENT>
Write detection to csv formatted file.

Will append if append==True and file exists

:type fname: str
:param fname: Full path to file to open and write to.
:type append: bool
:param append: Set to true to append to an existing file, if True \
    and file doesn't exist, will create new file and warn.  If False
    will overwrite old files.