def _object_done_handler(self, device_id, object_id, lom_object, parameters):
        if not (isinstance(lom_object, Live.Clip.Clip) and lom_object.is_midi_clip):
            raise AssertionError
            device_context = self.device_contexts[device_id][object_id]
            open_operations = device_context[OPEN_OPERATIONS_KEY]
            raise NOTE_OPERATION_KEY in open_operations and NOTE_COUNT_KEY in open_operations and (NOTE_BUFFER_KEY in open_operations or AssertionError)
            try:
                notes = tuple(open_operations[NOTE_BUFFER_KEY])
                if len(notes) != open_operations[NOTE_COUNT_KEY]:
                    raise LomNoteOperationWarning('wrong note count')
                operation = open_operations[NOTE_OPERATION_KEY]
                selector = self._selector_for_note_operation(operation)
                getattr(lom_object, selector)(notes)
            except LomNoteOperationWarning as w:
                self._warn(device_id, object_id, w.message)

            self._stop_note_operation(device_id, object_id)
        else:
            self._raise(device_id, object_id, 'no operation in progress')
 def _selector_for_note_operation(self, note_operation):
     if note_operation not in (NOTE_REPLACE_KEY, NOTE_SET_KEY):
         raise LomNoteOperationWarning('invalid note operation')
     return 'set_notes' if note_operation == NOTE_SET_KEY else 'replace_selected_notes'