This is how CSMat's code is performing the conversion (these conversion functions are basically copied over from CSMat). I'll check and see if izip will work in both cases.