'Bulk pre-fetches the enrollment states for the given users
for the given course.'

@classmethod
def bulk_fetch_enrollment_states(cls, users, course_key):

    request_cache.clear_cache(cls.MODE_CACHE_NAMESPACE)
    records = cls.objects.filter(user__in=users, course_id=course_key).select_related('user__id')
    cache = cls._get_mode_active_request_cache()
    for record in records:
        enrollment_state = CourseEnrollmentState(record.mode, record.is_active)
        cls._update_enrollment(cache, record.user.id, course_key, enrollment_state)
