code: def init_app(self, app):
          
          if not hasattr(app, 'extensions'):
              app.extensions = {}
  
          app.extensions['nav'] = self
          app.add_template_global(self.elems, 'nav')
  
          # register some renderers
          for args in self._renderers:
              register_renderer(app, *args)
docs: Initialize an application.
  
          :param app: A :class:`~flask.Flask` app.