'Return a set of CourseKeys for which the user has certificates.
Sometimes we just want to check if a user has already been issued a
certificate for a given course (e.g. to test refund elibigility).
Instead of checking if `certificate_for_student` returns `None` on each
course_id individually, we instead just return a set of all CourseKeys
for which this student has certificates all at once.'

@classmethod
def course_ids_with_certs_for_user(cls, user):

    return {cert.course_id for cert in cls.objects.filter(user=user).only('course_id')}
