It seems that you are trying to convert your Matrix assembled in Fenics to a sparse python format. I suggest you do it with PETScMatrix like this:
from dolfin import*
import numpy as np
from petsc4py import PETSc
import scipy.sparse as sp_sparse
Assembling your matrix goes here
test = M.mat()
row, col, data = test.getValuesCSR()
M_scipy = sp_sparse.csc_matrix((data, col, row), shape=(N_row, N_row),dtype=np.float)