def render_genshi(source_text, source_path, variables):
    assert genshi, "Genshi is not installed"
    if source_path:
        source = open(source_path)
    else:
        source = StringIO(source_text)
    try:
        tmpl = genshi.template.MarkupTemplate(source, filepath=source_path)
        stream = tmpl.generate(**variables)
        return stream.render('xml')
    except (genshi.template.TemplateError, __HOLE__) as error:
        raise errors.TemplateError("{0}: {1}: {2}".format(source_path, error.__class__.__name__, error))
dataset/ETHPy150Open ohmu/poni/poni/template.py/render_genshi