Finding the "simplest" rotation transform I am trying to undo some simple rotation errors of my sensor by tracking a reference plane. I am using the following accepted solution: Calculate Rotation Matrix to align Vector A to Vector B in 3d?
I simply find the matrix that aligns the observed plane vector to the known reference plane vector, and I get the rotation matrix that would undo my rotation.
Although I do not know the rotation around this vector, I observed there is usually none present. When my reference plane is conveniently placed perpendicularly to a main reference system axis, the obtained rotation matrix tends to be elementary: 
def unit_vector(vector):
    """ Returns the unit vector of the vector.  """
    return vector / np.linalg.norm(vector)

def rot_matrix(A,B):
    A = unit_vector(A)
    B = unit_vector(B)
    AxB = np.cross(A,B)
    ssc = np.array([[0,-AxB[2],AxB[1]], [AxB[2],0.0,-AxB[0]], [-AxB[1],AxB[0],0.0]])
    return np.eye(3) + ssc + np.matmul(ssc,ssc)*(1-np.dot(A,B))/(np.linalg.norm(AxB)**2)

# Transition matrix
A = rot_matrix([-0.1,0,0.99498743710662],[0,0,1])
At = rot_matrix([0,0,1],[-0.1,0,0.99498743710662])
print(A)

'''[[ 0.99498744  0.          0.1       ]
 [ 0.          1.          0.        ]
 [-0.1         0.          0.99498744]]'''

Moving the reference plain to a tilted position gives a more complicated transformation matrix, even though it is still the same elementary rotation as shown below:
mv = np.array([[0,-0.15,0.9775**0.5]]).T
f_new = np.matmul(At,mv)
print(f_new,mv)

B = rot_matrix(f_new[:,0],mv[:,0])
print(B)
'''[[ 9.95100497e-01 -1.48667118e-02  9.77444742e-02]
 [ 1.47938681e-02  9.99889484e-01  1.46998815e-03]
 [-9.77555258e-02 -1.67670737e-05  9.95210459e-01]]'''

Is there some way I can select a "simplified" form out of all the non-unique solutions? Or am I missing something obvious?
EDIT: After some thinking, the point is I want to avoid rotations around Z-axis altogether. Since there are only two degrees of freedom for each vector, is there a way I can design a rotation matrix from only Rx and Ry? Having your target vector on the Z-axis does that automatically, and I was wondering if I can replicate that directly.
 A: Thanks for your help, you helped me formulate the problem. Rhis is my solution:
def XY_rot(v1,v2):

    v1 = unit_vector(v1)
    v2 = unit_vector(v2)

    # Get k and n of line
    if (v2[0]-v1[0]) == 0:

        xi = v2[0]
        yi = 0
        p = [1,0,0]

    elif (v2[1]-v1[1]) == 0:

        xi = 0
        yi = v2[1]
        p = [0,1,0]

    else:

        k = (v2[1]-v1[1])/(v2[0]-v1[0])
        n = v1[1] - k*v1[0]

        # Get perpendicular and intersection
        kp = -1/k
        xi = n/(kp-k)
        yi = kp*xi
        kp2 = kp**2+1
        p = [(1/kp2)**0.5,kp*(1/kp2)**0.5,0] # We could use unit_vector([xi,yi,0]) but they can both be zero

    no = np.array([xi,yi,0]) # new origin
    vn1 = v1 - no
    vn2 = v2 - no
    # Signed angle calculation
    dot = np.dot(vn1,vn2)
    det = np.dot(p,np.cross(vn1,vn2))
    ang = math.atan2(det, dot)


    # Apply Rodriguez formula
    K = np.array([[0,0,p[1]],[0,0,-p[0]],[-p[1],p[0],0]])
    R = np.eye(3) + math.sin(ang)*K + (1-math.cos(ang))*np.matmul(K,K)

    return R

