<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_template(template_name, **context):
 """Load and generate a template."""

    context.update(href=href, format_datetime=format_datetime)
    return template_loader.load(template_name).generate(**context)