def render_template(template, **kwargs):
    """Render a template using the given keyword arguments as context

    :param template: the template string
    :type template: string
    :param kwargs: the context
    """
    if template is None or not isinstance(template, basestring):
        return template
    tmpl = _get_environment().from_string(template)
    ctx = dict(kwargs)
    if global_context is not None:
        for k, v in global_context.iteritems():
            if not k in ctx:
                ctx[k] = v
    # expose the global context
    ctx['_ctx'] = global_context
    if 'self' in ctx:
        del ctx['self']
    try:
        return tmpl.render(**ctx)
    except TemplateSyntaxError as err:
        raise RenderError(template, err.message, line=err.lineno)
dataset/ETHPy150Open thasso/pyjip/jip/templates.py/render_template/original