def canonize2(twos, threes, fives, horogram="JI"):
    """
    Reduce a pitch given in powers of two, three and five into a canonical form that has the same frequency based on the temperament.
    """
    # pylint: disable=invalid-name
    if horogram == "meantone":
        return (twos - 4*fives, threes + 4*fives, 0)

    if horogram == "augmented":
        return (twos + ((fives+1)//3)*7, threes, fives - ((fives+1)//3)*3)

    if horogram == "porcupine":
        m = fives - ((fives + 1)//3)*3
        return (twos - (fives - m)//3, threes + 5*(fives - m)//3, m)

    if horogram == "JI":
        return (twos, threes, fives)

    raise ValueError("Unrecognized temperament")