docs: def write(filename, data, extname=None, extver=None, units=None,
            compress=None, table_type='binary', header=None,
            clobber=False, **keys):
      """
      Convenience function to create a new HDU and write the data.
  
      Under the hood, a FITS object is constructed.  If you want to append rows
      to an existing HDU, or modify data in an HDU, please construct a FITS
      object.
  
      parameters
      ----------
      filename: string
          A filename.
      data:
          Either a normal n-dimensional array or a recarray.  Images are written
          to a new IMAGE_HDU and recarrays are written to BINARY_TBl or
          ASCII_TBL hdus.
      extname: string, optional
          An optional name for the new header unit.
      extver: integer, optional
          FITS allows multiple extensions to have the same name (extname).
          These extensions can optionally specify an EXTVER version number in
          the header.  Send extver= to set a particular version, which will
          be represented in the header with keyname EXTVER.  The extver must
          be an integer > 0.  If extver is not sent, the first one will be
          selected.  If ext is an integer, the extver is ignored.
      compress: string, optional
          A string representing the compression algorithm for images,
          default None.
          Can be one of
             'RICE'
             'GZIP'
             'GZIP_2'
             'PLIO' (no unsigned or negative integers)
             'HCOMPRESS'
          (case-insensitive) See the cfitsio manual for details.
  
      header: FITSHDR, list, dict, optional
          A set of header keys to write. The keys are written before the data
          is written to the table, preventing a resizing of the table area.
  
          Can be one of these:
              - FITSHDR object
              - list of dictionaries containing 'name','value' and optionally
                a 'comment' field; the order is preserved.
              - a dictionary of keyword-value pairs; no comments are written
                in this case, and the order is arbitrary.
          Note required keywords such as NAXIS, XTENSION, etc are cleaed out.
  
      clobber: bool, optional
          If True, overwrite any existing file. Default is to append
          a new extension on existing files.
  
      ignore_empty: bool, optional
          Default False.  Unless set to True, only allow
          empty HDUs in the zero extension.
  
  
      table keywords
      --------------
      These keywords are only active when writing tables.
  
      units: list
          A list of strings representing units for each column.
      table_type: string, optional
          Either 'binary' or 'ascii', default 'binary'
          Matching is case-insensitive
      write_bitcols: bool, optional
          Write boolean arrays in the FITS bitcols format, default False
  
  
      """
      with FITS(filename, 'rw', clobber=clobber, **keys) as fits:
          fits.write(data,
                     table_type=table_type,
                     units=units,
                     extname=extname,
                     extver=extver,
                     compress=compress,
                     header=header,
                     **keys)