code: def init_app(self, app, config_prefix='MONGOALCHEMY'):
          
  
          self.config_prefix = config_prefix
          def key(suffix):
              return '%s_%s' % (config_prefix, suffix)
  
          if key('DATABASE') not in app.config:
              raise ImproperlyConfiguredError("You should provide a database name "
                                              "(the %s setting)." % key('DATABASE'))
  
          uri = _get_mongo_uri(app, key)
          rs = app.config.get(key('REPLICA_SET'))
          timezone = None
          if key('TIMEZONE') in app.config:
              timezone = pytz.timezone(app.config.get(key('TIMEZONE')))
          self.session = session.Session.connect(app.config.get(key('DATABASE')),
                                                 safe=app.config.get(key('SAFE_SESSION'),
                                                                     False),
                                                 timezone = timezone,
                                                 host=uri, replicaSet=rs)
          self.Document._session = self.session
docs: This callback can be used to initialize an application for the use with this
          MongoDB setup. Never use a database in the context of an application not
          initialized that way or connections will leak.