Where is cmp used? I would just try to remove it, instead of putting this here, especially since using `<` in SymPy is a gotcha in itself.