[I do it a little differently](https://github.com/mozilla/zamboni/blob/master/mkt/site/helpers.py#L299-L308). choose which you like best; I kind of like yours better.