def safe_substitute_unicode_template(templated_string, variable_map):

    if PYTHON_MAJOR_VERSION > 2:  # Python 3 handles unicode templating natively, yay!
        return string.Template(templated_string).safe_substitute(variable_map)

    my_template = string.Template(encode_unicode_bytes(templated_string))
    my_escaped_dict = dict(map(lambda x: (x[0], encode_unicode_bytes(x[1])), variable_map.items()))
    templated = my_template.safe_substitute(my_escaped_dict)
    return text_type(templated, 'utf-8')
Determine if a planar mesh is convex; taking virtual edge normals into account
dataset/ETHPy150Open svanoort/pyresttest/pyresttest/parsing.py/safe_substitute_unicode_template--crossover with--dataset/ETHPy150Open turbulenz/turbulenz_tools/turbulenz_tools/tools/mesh.py/Mesh.is_convex_planar