<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def init_app(self, app, config_group="flask_keystone"):
 """ Iniitialize the Flask_Keystone module in an application factory. :param app: `flask.Flask` application to which to connect. :type app: `flask.Flask` :param str config_group: :class:`oslo_config.cfg.OptGroup` to which to attach. When initialized, the extension will apply the :mod:`keystonemiddleware` WSGI middleware to the flask Application, attach it's own error handler, and generate a User model based on its :mod:`oslo_config` configuration. """

        cfg.CONF.register_opts(RAX_OPTS, group=config_group)

        self.logger = logging.getLogger(__name__)
        try:
            logging.register_options(cfg.CONF)
        except cfg.ArgsAlreadyParsedError:  # pragma: no cover
            pass
        logging.setup(cfg.CONF, "flask_keystone")

        self.config = cfg.CONF[config_group]
        self.roles = self._parse_roles()
        self.User = self._make_user_model()
        self.Anonymous = self._make_anonymous_model()
        self.logger.debug("Initialized keystone with roles: %s and "
                          "allow_anonymous: %s" % (
                              self.roles,
                              self.config.allow_anonymous_access
                          ))
        app.wsgi_app = auth_token.AuthProtocol(app.wsgi_app, {})

        self.logger.debug("Adding before_request request handler.")
        app.before_request(self._make_before_request())
        self.logger.debug("Registering Custom Error Handler.")
        app.register_error_handler(FlaskKeystoneException, handle_exception)