Any reason you couldn't use the helper we already have: https://github.com/mozilla/kitsune/blob/master/kitsune/sumo/helpers.py#L208 ? You could call it from the template or here.