def METHOD_NAME(
    manager, instance, clean_input, catalogue, previous_end_date
):
    """Send the notification about starting or ending sale if it wasn't sent yet.
    Send notification if the notification when the start or end date already passed
    and the notification_date is not set or the last notification was sent
    before start or end date.
    """
    now = datetime.now(pytz.utc)
    notification_date = instance.notification_sent_datetime
    start_date = clean_input.get("start_date")
    end_date = clean_input.get("end_date")
    if not start_date and not end_date:
        return
    send_notification = False
    for date in [start_date, end_date]:
        if (
            date
            and date <= now
            and (notification_date is None or notification_date < date)
        ):
            send_notification = True
    # we always need to notify if the end_date is in the past and previously
    # the end date was not set
    if end_date and end_date <= now and previous_end_date is None:
        send_notification = True
    if send_notification:
        manager.sale_toggle(instance, catalogue)
        instance.notification_sent_datetime = now
        instance.save(update_fields=["notification_sent_datetime"])