@register.assignment_tag(takes_context=True)
def render_template_for(context, obj, template=None, template_directory=None):
    context['object'] = obj

    template_list = []
    if template:
        template_list.append(template)

    template_dirs = []
    if template_directory:
        template_dirs.append(template_directory)

    template_dirs.append('community/types')

    for directory in template_dirs:
        template_list.append('{}/{}.html'.format(directory, obj.get_media_type_display()))
        template_list.append('{}/default.html'.format(directory))

    output = render_to_string(template_list, context)
    return output
The Janitor returns string representations of the selectables that it
dataset/ETHPy150Open python/pythondotorg/community/templatetags/community.py/render_template_for--crossover with--dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/trial/test/test_util.py/JanitorTests.test_cleanReactorReturnsSelectableStrings