Cleaned up tempotools.rewrite_integer_tempo().

Added __str__ to mathtools.Ratio.