docs: def main():
      """Do the script."""
      parser = argparse.ArgumentParser(
          description='replace image header')
      parser.add_argument('--extname',
                          help='name of extension to in header')
      parser.add_argument('expnum', type=str,
                          help='exposure to update')
      parser.add_argument('-r', '--replace',
                          action='store_true',
                          help='store modified image back to VOSpace?')
      parser.add_argument('-v', '--verbose', action='store_true')
      parser.add_argument('--debug', action='store_true')
      parser.add_argument('--force', action='store_true', help="Re-run even if previous success recorded")
      parser.add_argument('--dbimages', help="VOSpace DATA storage area.", default="vos:OSSOS/dbimages")
  
      args = parser.parse_args()
      task = util.task()
      dependency = 'preproc'
      prefix = ""
  
      storage.DBIMAGES = args.dbimages
  
      level = logging.CRITICAL
      message_format = "%(message)s"
      if args.verbose:
          level = logging.INFO
      if args.debug:
          level = logging.DEBUG
          message_format = "%(module)s %(funcName)s %(lineno)s %(message)s"
      logging.basicConfig(level=level, format=message_format)
      storage.set_logger(task, prefix, args.expnum, None, None, False)
  
      message = storage.SUCCESS
      expnum = args.expnum
  
      exit_status = 0
      try:
          # skip if already succeeded and not in force mode
          if storage.get_status(task, prefix, expnum, "p", 36) and not args.force:
              logging.info("Already updated, skipping")
              sys.exit(0)
      
          image_hdulist = storage.get_image(args.expnum, return_file=False)
          ast_hdulist = storage.get_astheader(expnum, ccd=None)
  
          run_update_header(image_hdulist, ast_hdulist)
          image_filename = os.path.basename(storage.get_uri(expnum))
          image_hdulist.writeto(image_filename)
          if args.replace:
              dest = storage.dbimages_uri(expnum)
              storage.copy(image_filename, dest)
              storage.set_status('update_header', "", expnum, 'p', 36, message)
      except Exception as e:
          message = str(e)
          if args.replace:
              storage.set_status(task, prefix, expnum, 'p', 36, message)
          exit_status = message
          logging.error(message)
  
      return exit_status