Simplest way to drive a pose bone's global location
I already know I can find the global location using either of these methods:


Both will not give you the correct global matrix. The first lacks the armature object transformation and the second is twice multiplying the pose_bone location - it's in pb.matrix already. So the way to get global location is:

pbone_global_loc = (armature.matrix_world * pbone.matrix).to_translation()

And the way to get the pbone matrix back is:

pbone.matrix = armature.matrix_world.inverted() * pbone_global_loc

If the pbone_global_loc is 3x3 make it 4x4 with:

pbone_global_loc.to_4x4()