In order to help we need to know what effect you are trying to get. It would also be helpful to post your entire script because it is not clear what data you are using to try to offset the bones.
Trust me, you don’t want waste your time reading through all of the script just for the bone data part. I will though if needed.
I’m don’t think it’s needed now though:
I just posted the matrices had generated with my script, from the data in my files. You can see the location portion of the matrix (again, printed some matrices in my first post) always isn’t (0,0,0), but in the 3d view the bones appear at (0,0,0). Porting my script from B2.4 btw, where the bones show up correctly, that is, they don’t seem to be at (0,0,0) like here.