'Return non-canonical constructor arg1 equivalent to M'

def _arg1_for_noncanonical(self, M, sorted_indices=False):

    (data, indices, indptr) = _same_sum_duplicate(M.data, M.indices, indptr=M.indptr)
    if (not sorted_indices):
        for (start, stop) in izip(indptr, indptr[1:]):
            indices[start:stop] = indices[start:stop][::(-1)].copy()
            data[start:stop] = data[start:stop][::(-1)].copy()
    return (data, indices, indptr)
