This problem can has a basis "How do I calculate what the affine transformation is, if I have the coordinates before and after the transformation?"
There is a good explanation in maths.stackexchange which gives you the exact maths that you need to create the transformation matrix.
The question is then how do you implement this in code? You are using python, so numpy will be your friend here, and in particular, you need the numpy inverse matrix method which will find the inverse matrix needed.
From here, you can use the method and code described in this SO question to get to your final result of the specific angle. This basically says, now that we know the affine transformation, let's apply that to the base unit vectors, and see what the rotation is. NOTE (edit): the numpy implementation of the angle between two vectors can be found here