def _lazy_listen(self):
        """
        Ensures that the listener task only runs when actually needed.
        This function is a no-op if any of the preconditions is not met.

        Preconditions are:
        * The application is running (self._loop is set)
        * The task is not already running
        * There are subscriptions: either pending, or active
        """
        if all([
            self._loop,
            not self.running,
            self._subscriptions or (self._pending and not self._pending.empty()),
        ]):
            self._task = self._loop.create_task(self._listen())
Ensures that the listener task only runs when actually needed.
        This function is a no-op if any of the preconditions is not met.

        Preconditions are:
        * The application is running (self._loop is set)
        * The task is not already running
        * There are subscriptions: either pending, or active