reduce fractions python