Animation files are causing my models to deform incorrectly

https://gitlab.com/Worldblender/io_scene_numdlb
https://gitlab.com/Worldblender/io_scene_numdlb/blob/master/SSBUlt_NUMDLB.py
https://gitlab.com/Worldblender/io_scene_numdlb/blob/master/SSBUlt_NUANMB.py

Hi there, everyone. This is a set of two Blender addon scripts that import assets from the Nintendo Switch game Super Smash Bros. Ultimate. There is a model importer that works, and an animation importer that is WIP but nearly complete. However, there are a few problems with my code, and it is explained below.

I’m having a hard time dealing with meshes deforming incorrectly. I know what’s going wrong: the bone roll has not been recalculated so that meshes will reorient properly. This requires a partial rework of the NUMDLB importer as animation files expect the Y-axis as the up-axis. However, I discovered that only models imported from SMD files (Valve Source Models) will transform properly with my NUANMB importer. That’s because in those files the head-tail axis for each bone is not only on the Y-axis. Unless I decide that I create custom animations for these models (which will require that I learn more animation skills, so that I can make characters do walk cycles), I don’t have much hope left for bringing Smash fighters to life. Only a change in my code can potentially fix this problem, but I can’t comprehend the solution myself, as in, I don’t know exactly where my problem is at.

All the test files and screenshots can be found at https://drive.google.com/drive/folders/1oSr3aGRqMUvLi-5v4XoqgnVOHk5zJqP_?usp=sharing (the test subjects/fighters are Mario and Piranha Plant)

UPDATE: I eventually solved this problem on my own. The bone axises were being applied from each matrice, but I simply overwrote it, which I have now corrected. This effectively means that my models are now animation-ready, and now I can continue with my projects utilizing them.