def normalise_number(v):
    """Attempt to convert a value to a number.
    Will convert to int type if it has no decimal places.
    @param v: the value (string, int, float, etc) to convert.
    @returns: an int or float value
    @exception ValueError: if the value cannot be converted
    @see: L{is_number}
    """
    try:
        n = float(v)
        if n == int(n):
            return int(n)
        else:
            return n
    except:
        raise ValueError('Cannot convert to number: {}'.format(v))
