Yes, but it's used both in the logic and in the controllers, where would be the right place to put a shared function? `ckan/lib/helpers.py`? But it's not really a function for templates though.