def finalize(self, template_name, mobile_optimized=False, template_root='desktop', template_type='html'):
        """Insert common values into handler's dictionary for template.
        
        Load proper template according to current browser capacity.
        
        Mobile optimized templates are optional. Default to False.
        """
        if self.browser['ios'] and mobile_optimized:
            path = os.path.join('tpl', 'mobile', template_name + '.html')
        else:
            path = os.path.join('tpl', template_root, template_name + '.' + template_type)
        output = template.render(path, self.values)
        self.response.out.write(output)
Insert common values into handler's dictionary for template.
        
        Load proper template according to current browser capacity.
        
        Mobile optimized templates are optional. Default to False.
        
v2ex/babel/handlers/__init__.py