def autotype(s):
    """Automatively detect the type (int, float or string) of `s` and convert
    `s` into it."""
    if not isinstance(s, str):
        return s
    if s.isdigit():
        return int(s)
    try:
        return float(s)
    except ValueError:
        return s
