Blender 2.57 export all action set animations psa script Help!

I need some help on export all the action sets but I getting None in return. It only work in exporting one action set for the animations.

Here the file:

Here the file sample.

Can anyone help with this. This might be the last coding to be done.

Manage to fixed the script. I was lost in my own script and took a while think and manage to fixed it.

Here the update version.

Can you give some info as to which line/function returns None?

This for all action set export and doesn’t work.
Line 1355 posebonemat = parentposemat.invert() * posebonemat
Line 1358 quat = posebonemat.to_quaternion().normalize()
those return None

Single export.
Line 1513 posebonemat = parentposemat.invert() * posebonemat
Line 1517 quat = posebonemat.to_quaternion().normalize()
It works

Use these functions instead:

the ‘ed’ suffix denotes that a new copy is returned rather then modifying in-place, similar to pythons sort() / sorted() functions.

How to deal with the parent and non parent matrix coding. I wanted to get the head fixed location. Else it give offset of the head location of it. Not sure how to deal with invert > inverted when the value is different.