<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self, outfname=None):
 """Write or overwrite a `Survey` to the specified .DAT file"""

        outfname = outfname or self.filename
        with codecs.open(outfname, 'wb', 'windows-1252') as outf:
            for survey in self.surveys:
                outf.write('\r\n'.join(survey._serialize()))
                outf.write('\r\n'+'\f'+'\r\n')  # ASCII "form feed" ^L
            outf.write('\x1A')