Ik Stretch: Finding the Proportional Value
Finally found the answer from Rigify scripts:

    l1 = ulimb_p.length
    l2 = flimb_p.length
    if l1 &lt; l2:
        ulimb_p.ik_stretch = (l1 ** (1 / 3)) / (l2 ** (1 / 3))
        flimb_p.ik_stretch = 1.0
    else:
        ulimb_p.ik_stretch = 1.0
        flimb_p.ik_stretch = (l2 ** (1 / 3)) / (l1 ** (1 / 3))