def handle(client_message, handle_event_imap_invalidation=None, handle_event_imap_batch_invalidation=None, to_object=None):
message_type = client_message.get_message_type()<EOL>if message_type == EVENT_IMAPINVALIDATION and handle_event_imap_invalidation is not None:<EOL><INDENT>key = None<EOL>if not client_message.read_bool():<EOL><INDENT>key = client_message.read_data()<EOL><DEDENT>handle_event_imap_invalidation(key=key)<EOL><DEDENT>if message_type == EVENT_IMAPBATCHINVALIDATION and handle_event_imap_batch_invalidation is not None:<EOL><INDENT>keys_size = client_message.read_int()<EOL>keys = []<EOL>for _ in range(<NUM_LIT:0>, keys_size):<EOL><INDENT>keys_item = client_message.read_data()<EOL>keys.append(keys_item)<EOL><DEDENT>handle_event_imap_batch_invalidation(keys=keys)<EOL><DEDENT>
Event handler