Filtro Jinja2 Stars para Bootstrap

@app.template_filter('stars')
def _jinja2_filter_stars(value):
"""
Adds filled and empty stars

Usage: {{ obj.stars|stars|safe }}

"""

ret
= ""
if value:
for i in range(1, value+1):
ret
+= '<i class="icon-star"></i>'

for i in range(value, 5):
ret
+= '<i class="icon-star-empty"></i>'
return ret