import ast


def str_to_obj(var):
    """
    Convert a string that looks like a list, dict, tuple, or bool back into its
    native object form.
    """
    if not isinstance(var, str):
        return var
    elif var.startswith(("[", "{", "(")):
        try:
            return ast.literal_eval(var)
        except Exception:
            pass
    else:
        lowvar = var.strip().lower()
        if lowvar == "false":
            return False
        elif lowvar == "true":
            return True
    return var