Checks for deferred email, that otherwise fill up the queue.

def deferred_emails():
    """Checks for deferred email, that otherwise fill up the queue."""
    status = SERVER_STATUS['OK']
    count = Message.objects.deferred().count()

    if DEFERRED_WARNING_THRESHOLD <= count < DEFERRED_DANGER_THRESHOLD:
        status = SERVER_STATUS['WARNING']
    if count >= DEFERRED_DANGER_THRESHOLD:
        status = SERVER_STATUS['DANGER']

    return {
        'label': 'Deferred Email',
        'status': status,
        'info': 'There are currently {0} deferred messages.'.format(count)
    }