<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def assert_can(self, permission, obj, **kwargs):
 """Make sure we have a permission, or abort the request. :param permission: The permission to look for. :param obj: The object to check the ACL of. :param flash: The message to flask if denied (keyword only). :param stealth: Abort with a 404? (keyword only). :param **kwargs: The context to pass to predicates. """

        flash_message = kwargs.pop('flash', None)
        stealth = kwargs.pop('stealth', False)
        default = kwargs.pop('default', None)

        res = self.can(permission, obj, **kwargs)
        res = default if res is None else res

        if not res:
            if flash_message and not stealth:
                flask.flash(flash_message, 'danger')
            if current_user.is_authenticated():
                if flash_message is not False:
                    flask.flash(flash_message or 'You are not permitted to "%s" this resource' % permission)
                flask.abort(403)
            elif not stealth and self.login_view:
                if flash_message is not False:
                    flask.flash(flash_message or 'Please login for access.')
                raise _Redirect(flask.url_for(self.login_view) + '?' + urlencode(dict(next=
                    flask.request.script_root + flask.request.path
                )))
            else:
                flask.abort(404)