docs: def flush(signal_names, exclude, wait):
      """Send pending signals over the message bus.
  
      If a list of SIGNAL_NAMES is specified, flushes only those
      signals. If no SIGNAL_NAMES are specified, flushes all signals.
  
      """
  
      signalbus = current_app.extensions['signalbus']
      signal_names = set(signal_names)
      exclude = set(exclude)
      models_to_flush = signalbus.get_signal_models()
      if signal_names and exclude:
          click.echo('Warning: Specified both SIGNAL_NAMES and exclude option.')
      if signal_names:
          wrong_signal_names = signal_names - {m.__name__ for m in models_to_flush}
          models_to_flush = [m for m in models_to_flush if m.__name__ in signal_names]
      else:
          wrong_signal_names = exclude - {m.__name__ for m in models_to_flush}
      for name in wrong_signal_names:
          click.echo('Warning: A signal with name "{}" does not exist.'.format(name))
      models_to_flush = [m for m in models_to_flush if m.__name__ not in exclude]
      logger = logging.getLogger(__name__)
      try:
          if wait is not None:
              signal_count = signalbus.flush(models_to_flush, wait=max(0.0, wait))
          else:
              signal_count = signalbus.flush(models_to_flush)
      except Exception:
          logger.exception('Caught error while sending pending signals.')
          sys.exit(1)
      if signal_count == 1:
          logger.warning('%i signal has been successfully processed.', signal_count)
      elif signal_count > 1:
          logger.warning('%i signals have been successfully processed.', signal_count)