<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def before_request(self) -> Optional[Response]: """Determine if a user is allowed to view this route."""

        auth = request.authorization
        if not auth or not self._check_auth(auth.username, auth.password):
            return Response(
                'Could not verify your access level for that URL.\n'
                'You have to login with proper credentials', 401,
                {'WWW-Authenticate': 'Basic realm="Login Required"'}
            )
        session['logged_in'] = auth.username
        # pylint wants this return statement
        return None