code: def abort (aggregate):
      
      while True:
          try:
              aggregate.abort()
              aggregate.finish()
              aggregate.end_log_output(interrupt=True)
              break
          except KeyboardInterrupt:
              log.warn(LOG_CHECK, _("user abort; force shutdown"))
              aggregate.end_log_output(interrupt=True)
              abort_now()
docs: Helper function to ensure a clean shutdown.