def _flip_kron_order(mat4x4: np.ndarray) -> np.ndarray:
        """Given M = sum(kron(a_i, b_i)), returns M' = sum(kron(b_i, a_i))."""
        result = np.array([[0] * 4] * 4, dtype=np.complex128)
        order = [0, 2, 1, 3]
        for i in range(4):
            for j in range(4):
                result[order[i], order[j]] = mat4x4[i, j]
        return result
Given M = sum(kron(a_i, b_i)), returns M' = sum(kron(b_i, a_i)).