code: def write(self, img, start=0, **keys):
          
  
          dims = self.get_dims()
  
          if img.dtype.fields is not None:
              raise ValueError("got recarray, expected regular ndarray")
          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
              img_send = numpy.ascontiguousarray(img)
              array_to_native(img_send, inplace=True)
          else:
              img_send = array_to_native(img, inplace=False)
  
          if IS_PY3 and img_send.dtype.char == 'U':
              # for python3, we convert unicode to ascii
              # this will error if the character is not in ascii
              img_send = img_send.astype('S', copy=False)
  
          if not numpy.isscalar(start):
              # convert to scalar offset
              # note we use the on-disk data type to get itemsize
  
              offset = _convert_full_start_to_offset(dims, start)
          else:
              offset = start
  
          # see if we need to resize the image
          if self.has_data():
              self._expand_if_needed(dims, img.shape, start, offset)
  
          self._FITS.write_image(self._ext+1, img_send, offset+1)
          self._update_info()
docs: Write the image into this HDU
  
          If data already exist in this HDU, they will be overwritten.  If the
          image to write is larger than the image on disk, or if the start
          position is such that the write would extend beyond the existing
          dimensions, the on-disk image is expanded.
  
          parameters
          ----------
          img: ndarray
              A simple numpy ndarray
          start: integer or sequence
              Where to start writing data.  Can be an integer offset
              into the entire array, or a sequence determining where
              in N-dimensional space to start.