I would either use a function that converted a sequence of numbers into ranges, or you can use cmds.polyListComponentConversion. The downside being that it only works on polygon components and you have to know the component type.
I think it’s viable for displaying information about sequences/selection, but don’t know what application it would have in Maya. In any case I would do it as a sequence-to-range python conversion, not using methods in maya.