def get_all_valid_certificates_with_destination(destination_id):
    """
    Return list of certificates
    :param destination_id:
    :return:
    """
    return (
        Certificate.query.filter(Certificate.destinations.any(id=destination_id))
        .filter(Certificate.revoked == false())
        .filter(Certificate.not_after >= arrow.now())
        .filter(not_(Certificate.replaced.any()))
        .all()
    )

    Return list of certificates
    :param destination_id:
    :return:
    
lemur/certificates/service.py