How to invert trackpad direction in 2.93 with Python add-on?

Hi, recently with the release of 2.92, a change has been introduce to correct a “bug”. The unfortunate thing about this change is that not only does it make this change it removes the option for the user to revert this change, leaving the user powerless essentially. Very much an ‘Apple’ move as one user mentioned here: https://developer.blender.org/rB055ed335a111bebed7193acd083f54d5c82929ff

I would like to create a Python add-on to revert this change and give the user the option to invert their trackpad movements to “Natural”

However, while I can code in Python, I’m not exactly sure how to do this within bpy.

The farthest I’ve gotten is find this: https://blender.stackexchange.com/questions/81794/how-to-used-the-mousescroll-to-as-a-modal-function-to-for-example-move-the-obj

However, the docs say " Note that [bpy.types.bpy_struct] is not actually available from within Blender, it only exists for the purpose of documentation."

I know that fundamentally this is a simple change, all it takes is just making the scroll direction negative if positive and positive if negative.

However, I’m not exactly sure how to access, and manipulate the scroll direction while also not affecting performance in any way.

I will be posting my progress here for those who want to help. Another thing I just found out, how to get the region matrix, which basically gives the coordinates of zoom, and location of the viewport navigation:

def get_region_matrix():
    for area in bpy.context.screen.areas:
        if area.type == 'VIEW_3D':
            return area.spaces[0].region_3d.view_matrix

Which results in:

<Matrix 4x4 (-0.4939,  0.8695, 0.0000,   0.0000)
            (-0.3341, -0.1898, 0.9232,   0.0000)
            ( 0.8027,  0.4560, 0.3843, -17.6787)
            ( 0.0000,  0.0000, 0.0000,   1.0000)>

And if you move your mouse around in the viewport, and run the function again, it’ll produce different numbers. Yay! One small step…

Okay, so now I know that where the -17 is controls the zoom. Now if you paste something like this in the Python console:

get_region_matrix()[2][-1] = -3

It will change the zoom. yay! another small step.