'Will be round(self, ndigits) in 3.0.
Rounds half toward even.'

def __round__(self, ndigits=None):

    if (ndigits is None):
        (floor, remainder) = divmod(self.numerator, self.denominator)
        if ((remainder * 2) < self.denominator):
            return floor
        elif ((remainder * 2) > self.denominator):
            return (floor + 1)
        elif ((floor % 2) == 0):
            return floor
        else:
            return (floor + 1)
    shift = (10 ** abs(ndigits))
    if (ndigits > 0):
        return Fraction(round((self * shift)), shift)
    else:
        return Fraction((round((self / shift)) * shift))
