Convert to python long depending on value (and not on type)