old_contents: from werkzeug.utils import cached_property
  
  
  class Jinja2ApplicationMixin(object):
      @cached_property
      def jinja_env(self):
          # imported here as jinja is not required in setup.py.
          import jinja2
          return jinja2.Environment(loader=jinja2.ChoiceLoader([]))
  
      def add_templates(self, loader):
          self.jinja_env.loader.loaders.append(loader)
  
      def get_renderer(self, name):
          if isinstance(name, str):
              return self.jinja_env.get_template(name).render
          else:
              # assume callable
              return name
  
new_contents: # -*- coding: utf-8 -*-
  """
      verktyg.jinja2
      ~~~~~~~~~~~~~~
  
      :copyright: (c) 2014 by Ben Mather.
      :license: BSD, see LICENSE for more details.
  """
  
  
  def add_templates(self, *loaders):
      for loader in loaders:
          self.jinja_env.loader.loaders.append(loader)
  
  
  def get_renderer(self, name):
      if isinstance(name, str):
          return self.jinja_env.get_template(name).render
      else:
          # assume callable
          return name
  
  
  def bind(app, *loaders, **kwargs):
      """ Add a jinja2 environment to an application
      """
      # imported here as jinja is not required in setup.py.
      import jinja2
      app.jinja_env = jinja2.Environment(
          loader=jinja2.ChoiceLoader([]), **kwargs
      )
  
      app.add_method('add_templates', add_templates)
      app.add_method('get_renderer', get_renderer)
  
      app.add_templates(*loaders)
  
subject: refactor jinja2 module from mixin to bind function