def cast_str_to_int_float_bool_or_str(str_):
    """
    Convert str_ into the following data types (return the first successful): int, float, bool, or str.
    :param str_: str;
    :return: int, float, bool, or str;
    """
    value = str_.strip()
    for var_type in [int, float]:
        try:
            converted_var = var_type(value)
            return converted_var
        except ValueError:
            pass
    if value == 'True':
        return True
    elif value == 'False':
        return False
    return str(value)
