@register.simple_tag
def maintenance_alert():
    try:
        alert = (MaintenanceAlert.objects
                 .filter(active=True)
                 .order_by('-modified'))[0]
    except __HOLE__:
        return ''
    else:
        return format_html(
            '<div class="alert alert-warning" style="text-align: center; margin-bottom: 0;">{}</div>',
            mark_safe(alert.html),
        )
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/hqwebapp/templatetags/hq_shared_tags.py/maintenance_alert