code: def update_image(hdu_in, hdu=None):
      
      if hdu is None:
          hdu = fits.ImageHDU(
              data=hdu_in.data, header=hdu_in.header, name=hdu_in.name)
      else:
          hdu.data += hdu_in.data
      return hdu
docs: 'Update' an image HDU
  
      This checks hdu exists and creates it from hdu_in if it does not.
      If hdu does exist, this adds the data in hdu_in to hdu