code: def setup_signal_handlers(self):
          '''Setup Ctrl+C and SIGTERM handlers.'''
          if platform.system() == 'Windows':
              _logger.warning(_(
                  'Graceful stopping with Unix signals is not supported '
                  'on this OS.'
              ))
              return
  
          event_loop = asyncio.get_event_loop()
          graceful_called = False
  
          def graceful_stop_callback():
              nonlocal graceful_called
  
              if graceful_called:
                  forceful_stop_callback()
                  return
  
              graceful_called = True
  
              _logger.info(_('Stopping once all requests complete...'))
              _logger.info(_('Interrupt again to force stopping immediately.'))
              self.stop()
  
          def forceful_stop_callback():
              _logger.info(_('Forcing immediate stop...'))
              logging.raiseExceptions = False
              event_loop.stop()
  
          event_loop.add_signal_handler(signal.SIGINT, graceful_stop_callback)
          event_loop.add_signal_handler(signal.SIGTERM, forceful_stop_callbackf setup_signal_handlers(self):
          '''Setup Ctrl+C and SIGTERM handlers.'''
          if platform.system() == 'Windows':
              _logger.warning(_(
                  'Graceful stopping with Unix signals is not supported '
                  'on this OS.'
              ))
              return
  
          event_loop = asyncio.get_event_loop()
          graceful_called = False
  
          def graceful_stop_callback():
              nonlocal graceful_called
  
              if graceful_called:
                  forceful_stop_callback()
                  return
  
              graceful_called = True
  
              _logger.info(_('Stopping once all requests complete...'))
              _logger.info(_('Interrupt again to force stopping immediately.'))
              self.stop()
  
          def forceful_stop_callback():
              _logger.info(_('Forcing immediate stop...'))
              logging.raiseExceptions = False
              event_loop.stop()
  
          event_loop.add_signal_handler(signal.SIGINT, graceful_stop_callback)
          event_loop.add_signal_handler(signal.SIGTERM, forceful_stop_callback)
docs: Setup Ctrl+C and SIGTERM handlers.