def send_authority_expiration_notifications():
    """
    This function will check for upcoming certificate authority certificate expiration,
    and send out notification emails at configured intervals.
    """
    success = failure = 0

    # security team gets all
    security_email = current_app.config.get("LEMUR_SECURITY_TEAM_EMAIL")

    for owner, owner_cert_groups in get_eligible_authority_certificates().items():
        for interval, certificates in owner_cert_groups.items():
            notification_data = []
            cert_ids = []

            for certificate in certificates:
                cert_data = certificate_notification_output_schema.dump(
                    certificate
                ).data
                cert_data['self_signed'] = is_selfsigned(certificate.parsed_cert)
                cert_data['issued_cert_count'] = certificates_service.get_issued_cert_count_for_authority(certificate.root_authority)
                notification_data.append(cert_data)
                cert_ids.append(certificate.id)

            email_recipients = security_email + [owner]
            email_tags = {"cert_ids": cert_ids}
            if send_default_notification(
                    "authority_expiration", notification_data, email_recipients,
                    notification_options=[{'name': 'interval', 'value': interval}], email_tags=email_tags
            ):
                success = len(email_recipients)
            else:
                failure = len(email_recipients)

    return success, failure

    This function will check for upcoming certificate authority certificate expiration,
    and send out notification emails at configured intervals.
    
lemur/notifications/messaging.py