Python Rational Number Classification