def number(astring):
    """Convert a string into a float or integer
    Returns original string if it can't convert it.
    """
    try:
        num = float(astring)
        if num % 1 == 0:
            num = int(num)
        return num
    except ValueError:
        return astring
