def render(template, mapping):
    """
    Render template document aginst mapping dictionary with jinja2.

    :param str template:
    :param dict mapping:
    :return:
    :rtype: str
    """
    from jinja2 import Environment, DictLoader
    env = Environment(loader=DictLoader({'cfn': str(template)}))
    tpl = env.get_template('cfn')
    return tpl.render(mapping)
