def METHOD_NAME(
    user: AbstractUser, request
):
    """
    Extracts the untrusted client session id from the requests headers and sets it
    on a custom attr on the user object for later retrieval. If the header is not set
    then nothing will be set. If the header is set but has an invalid value then an
    APIException will be raised.
    :param user: The user to set the client id attr on.
    :param request: The request containing the headers to check.
    """
    session_id = request.headers.get(settings.CLIENT_SESSION_ID_HEADER, None)
    if session_id is not None:
        _raise_if_not_valid_untrusted_client_session_id(session_id)
        set_untrusted_client_session_id(user, session_id)