'Renders the configured template as a module.
There are two relevant configuration settings:
COURSE_REVIEWS_TOOL_PROVIDER_FRAGMENT_NAME points to the template that
will be rendered and returned.
COURSE_REVIEWS_TOOL_PROVIDER_PLATFORM_KEY references the platform that
hosts the course. Generally, this is the domain name of the platform,
for example, \'edx.org\' would have a platform key of \'edx\'.'

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

    course_reviews_fragment_provider_template = settings.COURSE_REVIEWS_TOOL_PROVIDER_FRAGMENT_NAME
    course_platform_key = settings.COURSE_REVIEWS_TOOL_PROVIDER_PLATFORM_KEY
    if (not self.is_configured()):
        return None
    context = {'course': course, 'platform_key': course_platform_key}
    provider_reviews_template = ('course_experience/course_reviews_modules/%s' % course_reviews_fragment_provider_template)
    html = render_to_string(provider_reviews_template, context)
    return Fragment(html)
