'Maya, turn off Segment Scale Compensate and keep pose unchanged in python?

I have already make many animations using Segment Scale Compensate, I need to import these animations to Unity, unfortunately, while SSC is enabled, animations won't work fine in Unity.
Since I have many animations, I don't want to modify them manually, so I need a script to turn off SSC and keep animation unchanged.
Does anyone know how to do that?

Example fbx file here:https://www.mediafire.com/file/y4gl7b56tknb68f/SSC.fbx/file
image
Bip001_Spine2_M's scale is (1, 2, 2)
child bone Bip001_Clavicle_L turn off SSC, so it got a bad scale
child bone Bip001_Clavicle_R turn on SSC, so it got a good scale, I want to keep this result after turn off SSC.
I try to lower Bip001_Clavicle_R's scale, but since its scale axis is diffrent to parent's scale axis, so that's not going to work.
I think it need some matrix operation, but I am really a noob at matrix math, I spent many hours and still got nothing, really need help.
Thanks!

Updated:
Here's python code to turn off Segment Scale Compensate for Bip001_Clavicle_R
Then you can see the problem

import maya.cmds as cmds
cmds.setAttr("Bip001_Clavicle_R.segmentScaleCompensate", 0)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source