def recast_string(value):
    """Converts a string to some type of number or True/False if possible

    Args:
        value (str): A string that may represent an int or float

    Returns:
        int, float, bool, str, or None: The most precise numerical or boolean
        representation of ``value`` if ``value`` is a valid string-encoded
        version of that type.  Returns the unchanged string otherwise.
    """

    ### the order here is important, but hex that is not prefixed with
    ### 0x may be misinterpreted as integers.
    new_value = value
    for cast in (int, float, lambda x: int(x, 16)):
        try:
            new_value = cast(value)
            break
        except ValueError:
            pass

    if value == "True":
        new_value = True
    elif value == "False":
        new_value = False
    elif value == "null": # for mmperfmon
        new_value = None

    return new_value