def handle(client_message, handle_event_partitionlost = None, to_object=None):
    """ Event handler """
    message_type = client_message.get_message_type()
    if message_type == EVENT_PARTITIONLOST and handle_event_partitionlost is not None:
        partition_id = client_message.read_int()
        lost_backup_count = client_message.read_int()
        source=None
        if not client_message.read_bool():
            source = AddressCodec.decode(client_message, to_object)
        handle_event_partitionlost(partition_id=partition_id, lost_backup_count=lost_backup_count, source=source)
dataset/ETHPy150Open hazelcast/hazelcast-python-client/hazelcast/protocol/codec/client_add_partition_lost_listener_codec.py/handle/original