'Renders the welcome message fragment for the specified course.
Returns: A fragment, or None if there is no welcome message.'

def render_to_fragment(self, request, course_id=None, **kwargs):

    course_key = CourseKey.from_string(course_id)
    course = get_course_with_access(request.user, 'load', course_key, check_if_enrolled=True)
    welcome_message_html = self.welcome_message_html(request, course)
    if (not welcome_message_html):
        return None
    dismiss_url = reverse('openedx.course_experience.dismiss_welcome_message', kwargs={'course_id': unicode(course_key)})
    context = {'dismiss_url': dismiss_url, 'welcome_message_html': welcome_message_html}
    if (get_course_tag(request.user, course_key, PREFERENCE_KEY) == 'False'):
        return None
    else:
        html = render_to_string('course_experience/welcome-message-fragment.html', context)
        return Fragment(html)
