def METHOD_NAME(self, widget, event):
    """
    Finishes or cancels insertion of markers
    """
    if event.button == Gdk.BUTTON_PRIMARY:
        if self.move_finish():
            if providers.get_provider('playback-markers', 'repeat-end') is None:
                position = event.x / widget.get_allocation().width
                self.end_marker.props.position = position
                providers.register('playback-markers', self.end_marker)
                self.move_begin(self.end_marker)
            return True
    elif event.triggers_context_menu():
        if self.move_cancel():
            self.clear_markers()
            return True
    return False