Register function to templates.

def register(self, func):
        """ Register function to templates. """
        if callable(func):
            self.functions[func.__name__] = func
        return func