Rotate crop box of multiple views

Hi!
I’m trying to rotate a view and the crop box (by selecting a wall and getting the angle between this and a 0,1,0 vector) I’ve tried this python code but it gives me an error:

The code in this post works partially, rotates the view but not the crop box…

Any ideas?? Thanks!!