Python Finding Lowest Term