

def stop_listening(self, registration_id, encode_remove_listener):
    try:
        (actual_id, correlation_id) = self.registrations.pop(registration_id)
        self._client.invoker._remove_event_handler(correlation_id)
        self._client.invoker.invoke_on_random_target(encode_remove_listener(actual_id)).result()
        return True
    except KeyError:
        return False

dataset/ETHPy150Open hazelcast/hazelcast-python-client/hazelcast/invocation.py ListenerService.stop_listening/original