def expand(template_str, dictionary, **kwargs):
 t = Template(template_str, **kwargs)
 return t.expand(dictionary)

def expand ( template_str , dictionary , ** kwargs ) : t = Template ( template_str , ** kwargs ) return t . expand ( dictionary )
free function to expands a template string with a data dictionary .