'Renders a course message fragment for the specified course.'

def render_to_fragment(self, request, course_id, user_access, **kwargs):

    course_key = CourseKey.from_string(course_id)
    course = get_course_with_access(request.user, 'load', course_key)
    now = datetime.now(UTC())
    already_started = (course.start and (now > course.start))
    days_until_start_string = ('started' if already_started else format_timedelta((course.start - now), locale=to_locale(get_language())))
    course_start_data = {'course_start_date': format_date(course.start, locale=to_locale(get_language())), 'already_started': already_started, 'days_until_start_string': days_until_start_string}
    self.register_course_home_messages(request, course, user_access, course_start_data)
    course_home_messages = list(CourseHomeMessages.user_messages(request))
    if (user_access['is_enrolled'] and already_started):
        return None
    image_src = 'course_experience/images/home_message_author.png'
    context = {'course_home_messages': course_home_messages, 'image_src': image_src}
    html = render_to_string('course_experience/course-messages-fragment.html', context)
    return Fragment(html)
