<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _hdu_on_disk(self, hdulist_index):
 """ IRAF routines such as daophot need input on disk. Returns: filename: str The name of the file containing the FITS data. """

        if self._tempfile is None:
            self._tempfile = tempfile.NamedTemporaryFile(
                mode="r+b", suffix=".fits")
            self.hdulist[hdulist_index].writeto(self._tempfile.name)
        return self._tempfile.name