<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def direct_to_template(request, template, extra_context=None, **kwargs):
 """ Replacement for Django's ``direct_to_template`` that uses ``TemplateResponse`` via ``yacms.utils.views.render``. """

    context = extra_context or {}
    context["params"] = kwargs
    for (key, value) in context.items():
        if callable(value):
            context[key] = value()
    return TemplateResponse(request, template, context)