Uses a jinja template to wrap the content inside a layout.
    Wraps the content inside a block and adds the extend statement before rendering it
    with jinja. The block name can be specified in the layout_name after the filename separated
    by a colon. The default block name is "content".

def render_layout(layout_name, content, **context):
    """Uses a jinja template to wrap the content inside a layout.
    Wraps the content inside a block and adds the extend statement before rendering it
    with jinja. The block name can be specified in the layout_name after the filename separated
    by a colon. The default block name is "content".
    """
    layout_block = "content"
    if ":" in layout_name:
        layout_name, layout_block = layout_name.split(":")
    tpl = '{%% extends "%s" %%}{%% block %s %%}%s{%% endblock %%}' % (layout_name, layout_block, content)
    return render_template_string(tpl, **context)