def nicenumber(x):
    """
    Return a nice number close to x.
    """
    if x == 0:
        return x
    n = 1.0
    while x > 10:
        x /= 10
        n *= 10
    while x < 1:
        x *= 10
        n /= 10
    return int(x) * n
