def mktempfile(self, data=None, prefix='<STR_LIT>'):
filename = tempfile.mktemp('<STR_LIT>', prefix)<EOL>self.tempfiles.append(filename)<EOL>if data:<EOL><INDENT>tmp_file = open(filename,'<STR_LIT:w>')<EOL>tmp_file.write(data)<EOL>tmp_file.close()<EOL><DEDENT>return filename<EOL>
Make a new tempfile and return its filename.

        This makes a call to tempfile.mktemp, but it registers the created
        filename internally so ipython cleans it up at exit time.

        Optional inputs:

          - data(None): if data is given, it gets written out to the temp file
          immediately, and the file is closed again.