def cleanup_connection(self, connection, cause):
        for correlation_id, invocation in dict(self._pending).iteritems():
            if invocation.sent_connection == connection:
                self._handle_exception(invocation, cause)

        if self._client.lifecycle.is_live:
            for correlation_id, invocation in dict(self._event_handlers).iteritems():
                if invocation.sent_connection == connection or invocation.connection is None:
                    self._client.listener.re_register_listener(invocation)
dataset/ETHPy150Open hazelcast/hazelcast-python-client/hazelcast/invocation.py/InvocationService.cleanup_connection/operator `and` -> `or`