def notify_slice_expirations():

    expiration_time = datetime.now() + timedelta(
        seconds=settings.SLICE_EXPIRATION_NOTIFICATION_TIME)
    
    almost_expired_slices = Slice.objects.filter(
        expiration_date__lte=expiration_time, started=True)

    for slice in almost_expired_slices:
        try:
            send_mail(
                "Your slice %s is almost expired." % slice,
                "Your slice %s is almost expired. If you don't do anything, "
                "it will expired on %s. "
                "To renew your slice, you will need to update the "
                "slice's expiration date." % (slice, slice.expiration_date),
                from_email=settings.DEFAULT_FROM_EMAIL,
                recipient_list=[slice.owner.email],
            )
        except:
            logger.error(
                "Error sending almost expired slice "
                "email to user: %s" % traceback.format_exc())
    
# schedule jobs
# XXX: Expiration mechanism review needed
#try:
#    Job.objects.schedule_post_syncdb(settings.SLICE_EXPIRATION_CHECK_INTERVAL, stop_expired_slices)
#except JobAlreadyScheduled:
#    pass
#
#try:
#    Job.objects.schedule_post_syncdb(settings.SLICE_EXPIRATION_NOTIFICATION_TIME, notify_slice_expirations)
#except JobAlreadyScheduled:
#    pass
True if we've connected the websocket and exchanged initial handshake messages.
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/slice/models.py/notify_slice_expirations--crossover with--dataset/ETHPy150Open bokeh/bokeh/bokeh/client/_connection.py/ClientConnection.connected