code: def write_fits(self, data, outfile, extname="SKYMAP", clobber=True):
          
          hdu_prim = fits.PrimaryHDU()
          hdu_hpx = self.make_hdu(data, extname=extname)
          hl = [hdu_prim, hdu_hpx]
          if self.conv.energy_hdu == 'EBOUNDS':
              hdu_energy = self.make_energy_bounds_hdu()
          elif self.conv.energy_hdu == 'ENERGIES':
              hdu_energy = self.make_energies_hdu()
          if hdu_energy is not None:
              hl.append(hdu_energy)
          hdulist = fits.HDUList(hl)
          hdulist.writeto(outfile, overwrite=clobber)
docs: Write input data to a FITS file
  
          data      : The data begin stored
          outfile   : The name of the output file
          extname   : The HDU extension name        
          clobber   : True -> overwrite existing files