def _strip_spaces(self, caller=None): from django.utils.html import strip_spaces_between_tags return strip_spaces_between_tags(caller().strip()) # nicer import names