import math


def nice(v):
    """Returns nearest nice number

    Give highest value if equally close to two nice numbers

    """
    e = math.floor(math.log10(v))  # Exponent
    b = v / 10**e
    if b < 1.5:
        a = 1
    elif b < 3.5:
        a = 2
    elif b < 7.5:
        a = 5
    else:
        a = 10
    d = a*10**e
    return d