def _dispatch_connection_events(self):
        """Dispatch ready connection events"""
        if not self._ready_events:
            return

        with self._acquire_event_dispatch() as dispatch_acquired:
            if not dispatch_acquired:
                # Nested dispatch or dispatch blocked higher in call stack
                return

            # Limit dispatch to the number of currently ready events to avoid
            # getting stuck in this loop
            for _ in compat.xrange(len(self._ready_events)):
                try:
                    evt = self._ready_events.popleft()
                except __HOLE__:
                    # Some events (e.g., timers) must have been cancelled
                    break

                evt.dispatch()
dataset/ETHPy150Open pika/pika/pika/adapters/blocking_connection.py/BlockingConnection._dispatch_connection_events