code: def save(self, filename, clobber=True, **kwargs):
          
          
          if os.path.exists(filename) and not clobber:
              raise IOError("filename '{0}' exists and we have been asked not to"\
                  " clobber it".format(filename))
          
          if not filename.endswith('fits'):
              # ASCII
              data = np.hstack([
                  self.disp.reshape(-1, 1),
                  self.flux.reshape(-1, 1),
                  self.variance.reshape(-1, 1)
                  ])
              return np.savetxt(filename, data, **kwargs)
              
          else:          
              # Create a tabular FITS format
              disp = fits.Column(name='disp', format='1D', array=self.disp)
              flux = fits.Column(name='flux', format='1D', array=self.flux)
              var = fits.Column(name='variance', format='1D', array=self.variance)
              table_hdu = fits.new_table([disp, flux, var])
  
              # Create Primary HDU
              hdu = fits.PrimaryHDU()
  
              # Update primary HDU with headers
              for key, value in self.headers.iteritems():
                  if len(key) > 8: # To deal with ESO compatibility
                      hdu.header.update('HIERARCH {}'.format(key), value)
  
                  try:
                      hdu.header.update(key, value)
                  except ValueError:
                      logger.warn("Could not save header key/value combination: "\
                          "{0} = {1}".format(key, value))
  
              # Create HDU list with our tables
              hdulist = fits.HDUList([hdu, table_hdu])
              return hdulist.writeto(filename, clobber=clobber, **kwargs)
docs: Save the `Spectrum1D` object to the specified filename.
          
          :param filename:
              The filename to save the Spectrum1D object to.
  
          :type filename:
              str
  
          :param clobber: [optional]
              Whether to overwrite the `filename` if it already exists.
  
          :type clobber:
              bool
  
          :raises IOError:
              If the filename exists and we were not asked to clobber it.