(a, b)
return q + (2*r + (q&1) > b)
Closest integer to a/b, a and b positive integers; rounds to even
    in the case of a tie.
Closest integer to a/b, a and b positive integers; rounds to even
    in the case of a tie.
Closest integer to a / b a and b positive integers ; rounds to even in the case of a tie .
def _div_nearest(a, b):
    """Closest integer to a/b, a and b positive integers; rounds to even
    in the case of a tie.

    """
    q, r = divmod(a, b)
    return q + (2*r + (q&1) > b)
def _div_nearest ( a , b ) : q , r = divmod ( a , b ) return q + ( 2 * r + ( q & 1 ) > b )