How to read a bone's quaternion rotation and convert from local bone to world space
Based on some simple experiments it seems that

debone = Matrix([[1,0,0,0],[0,0,-1,0], [0,1,0,0],[0,0,0,1]]) #because bones are wacky
m = armature_object.matrix_world * poseBone.matrix * debone
o2.rotation_mode = 'QUATERNION'
o2.location, o2.rotation_quaternion, o2.scale = m.decompose()


will align o2 with poseBone (unless o2 has a parent causing its matrix_local to not be identical to matrix_world)