def notify_expiring_deployed_certificates(exclude):
    """
    Attempt to find any certificates that are expiring soon but are still deployed, and notify the certificate owner.
    This information is retrieved from the database, and is based on the previous run of
    identify_expiring_deployed_certificates.
    """
    status = FAILURE_METRIC_STATUS
    try:
        print("Starting to notify owners about certificates that are expiring but still deployed!")
        certificates = get_expiring_deployed_certificates(exclude).items()
        success = send_expiring_deployed_certificate_notifications(certificates)
        print(
            f"Finished notifying owners about certificates that are expiring but still deployed! Success: {success}"
        )
        if success:
            status = SUCCESS_METRIC_STATUS
    except Exception:
        capture_exception()

    metrics.send(
        "notify_expiring_deployed_certificates_job", "counter", 1, metric_tags={"status": status}
    )

    Attempt to find any certificates that are expiring soon but are still deployed, and notify the certificate owner.
    This information is retrieved from the database, and is based on the previous run of
    identify_expiring_deployed_certificates.
    
lemur/notifications/cli.py