def rint(value):
    """
    >>> rint(0.5) == 0
    True
    >>> rint(0.501) == 1
    True
    >>> rint(1.5) == 2
    True
    """
    ret = round(value)
    return 2.0 * round(value / 2.0) if abs(ret - value) == 0.5 else ret
