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

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