docs: def create_image_hdu(self,
                           img=None,
                           dims=None,
                           dtype=None,
                           extname=None,
                           extver=None,
                           compress=None,
                           tile_dims=None,
                           header=None):
          """
          Create a new, empty image HDU and reload the hdu list.  Either
          create from an input image or from input dims and dtype
  
              fits.create_image_hdu(image, ...)
              fits.create_image_hdu(dims=dims, dtype=dtype)
  
          If an image is sent, the data are also written.
  
          You can write data into the new extension using
              fits[extension].write(image)
  
          Alternatively you can skip calling this function and instead just use
  
              fits.write(image)
              or
              fits.write_image(image)
  
          which will create the new image extension for you with the appropriate
          structure, and write the data.
  
          parameters
          ----------
          img: ndarray, optional
              An image with which to determine the properties of the HDU. The
              data will be written.
          dims: sequence, optional
              A sequence describing the dimensions of the image to be created
              on disk.  You must also send a dtype=
          dtype: numpy data type
              When sending dims= also send the data type.  Can be of the
              various numpy data type declaration styles, e.g. 'f8',
              numpy.float64.
          extname: string, optional
              An optional extension name.
          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
              This is only used to determine how many slots to reserve for
              header keywords
  
          restrictions
          ------------
          The File must be opened READWRITE
          """
  
          if (img is not None) or (img is None and dims is None):
              from_image = True
          elif dims is not None:
              from_image = False
  
          if from_image:
              img2send = img
              if img is not None:
                  dims = img.shape
                  dtstr = img.dtype.descr[0][1][1:]
                  if img.size == 0:
                      raise ValueError("data must have at least 1 row")
  
                  # data must be c-contiguous and native byte order
                  if not img.flags['C_CONTIGUOUS']:
                      # this always makes a copy
                      img2send = numpy.ascontiguousarray(img)
                      array_to_native(img2send, inplace=True)
                  else:
                      img2send = array_to_native(img, inplace=False)
  
                  if IS_PY3 and img2send.dtype.char == 'U':
                      # for python3, we convert unicode to ascii
                      # this will error if the character is not in ascii
                      img2send = img2send.astype('S', copy=False)
  
              else:
                  self._ensure_empty_image_ok()
                  compress = None
                  tile_dims = None
  
              # we get dims from the input image
              dims2send = None
          else:
              # img was None and dims was sent
              if dtype is None:
                  raise ValueError("send dtype= with dims=")
  
              # this must work!
              dtype = numpy.dtype(dtype)
              dtstr = dtype.descr[0][1][1:]
              # use the example image to build the type in C
              img2send = numpy.zeros(1, dtype=dtype)
  
              # sending an array simplifies access
              dims2send = numpy.array(dims, dtype='i8', ndmin=1)
  
          if img2send is not None:
              if img2send.dtype.fields is not None:
                  raise ValueError(
                      "got record data type, expected regular ndarray")
  
          if extname is None:
              # will be ignored
              extname = ""
          else:
              if not isstring(extname):
                  raise ValueError("extension name must be a string")
              extname = mks(extname)
  
          if extname is not None and extver is not None:
              extver = check_extver(extver)
  
          if extver is None:
              # will be ignored
              extver = 0
  
          comptype = get_compress_type(compress)
          tile_dims = get_tile_dims(tile_dims, dims)
  
          if img2send is not None:
              check_comptype_img(comptype, dtstr)
  
          if header is not None:
              nkeys = len(header)
          else:
              nkeys = 0
  
          self._FITS.create_image_hdu(img2send,
                                      nkeys,
                                      dims=dims2send,
                                      comptype=comptype,
                                      tile_dims=tile_dims,
                                      extname=extname,
                                      extver=extver)
  
          # don't rebuild the whole list unless this is the first hdu
          # to be created
          self.update_hdu_list(rebuild=False)