Python: correct angular offset between a vector and an object's worldOrientation?

So I’ve got a standard raycast bullethole script, and I want to add deflection. Now, what I want to do is take the negative vector from the ray’s hit normal and find the angular difference between that and the orientation of the ray caster (casting along the +Z axis), so I can get the angle of collision relative to the launching object (the gun), and use THAT to calculate the angle of ricochet for the bullet.

What I need help with is getting the angular difference between the gun’s angle and the ray normal vector. I know there’s a simple way to do this, but somehow I haven’t managed it yet. Anyone able to help? Ideas? Thanks!