code: def write(filename,data,**kwargs):
      
      base,ext = os.path.splitext(filename)
      if ext in ('.fits','.fz'):
          # Abstract fits here...
          return fitsio.write(filename,data,**kwargs)
      elif ext in ('.npy'):
          return np.save(filename,data,**kwargs)
      elif ext in ('.csv'):
          return np.savetxt(filename,data,header=','.join(data.dtype.names),delimiter=',',**kwargs)
      elif ext in ('.txt','.dat'):
          return np.savetxt(filename,data,**kwargs)
  
      msg = "Unrecognized file type: %s"%filename
      raise ValueError(msg)
docs: Write a recarray to a specific format.
      Accepted file formats: [.fits,.fz,.npy,.csv,.txt,.dat]
      
      Parameters:
      filename : output file name
      data     : the recarray data
      kwargs   : keyword arguments for the writer
      Returns:
      ret      : writer return (usually None)