How to get permutation matrix?

Hi all,
When I use parameters['reorder_dofs_serial'] = True, I get a stiffness matrix.
And do not use parameters['reorder_dofs_serial'] = True, I get another stiffness matrix.
So how to obtain the permutation matrix between the two matrices?