def METHOD_NAME(request) -> GatewayUser:
    try:
        sub = request.headers["X-Forwarded-User"]
        username = request.headers["X-Forwarded-User-Username"]
        first_name = request.headers["X-Forwarded-User-First-Name"]
        last_name = request.headers["X-Forwarded-User-Last-Name"]
        email = request.headers["X-Forwarded-User-Email"]
        roles = request.headers["X-Forwarded-User-Roles"].split(",")
        user_type = request.headers["X-Forwarded-User-Type"]
    except Exception:
        raise ParseError(detail="Request did not provide correct header.", code="malformed_header")
    return GatewayUser(sub, username, first_name, last_name, email, roles, user_type)