(instance, save_function)
return False
:return: True if the event was handled, otherwise False
:return: True if the event was handled, otherwise False
: return : True if the event was handled otherwise False
def _handle_schedule_instance(instance, save_function):
    """
    :return: True if the event was handled, otherwise False
    """
    if (
        instance.memoized_schedule.deleted or
        (isinstance(instance, CaseScheduleInstanceMixin) and (instance.case is None or instance.case.is_deleted))
    ):
        instance.delete()
        return False

    if instance.active and instance.next_event_due < datetime.utcnow():
        # We have to call check_active_flag_against_schedule before processing
        # in case the schedule was deactivated and the task which deactivates
        # instances hasn't finished yet. We also have to call it after processing
        # to handle the other checks whose result might change based on next_event_due
        # changing.
        instance.check_active_flag_against_schedule()
        if not instance.active:
            # The instance was just deactivated
            save_function(instance)
            return False

        instance.handle_current_event()
        instance.check_active_flag_against_schedule()
        save_function(instance)
        return True

    return False
def _handle_schedule_instance ( instance , save_function ) : if ( instance . memoized_schedule . deleted or ( isinstance ( instance , CaseScheduleInstanceMixin ) and ( instance . case is None or instance . case . is_deleted ) ) ) : instance . delete ( ) return False if instance . active and instance . next_event_due < datetime . utcnow ( ) : # We have to call check_active_flag_against_schedule before processing # in case the schedule was deactivated and the task which deactivates # instances hasn't finished yet. We also have to call it after processing # to handle the other checks whose result might change based on next_event_due # changing. instance . check_active_flag_against_schedule ( ) if not instance . active : # The instance was just deactivated save_function ( instance ) return False instance . handle_current_event ( ) instance . check_active_flag_against_schedule ( ) save_function ( instance ) return True return False