def is_basic_datatype(value):
    """
    We only save "basic" datatypes like ints, floats, strings and
    lists, dictionaries or sets of these as pickles in restart files

    This function returns True if the datatype is such a basic data
    type
    """
    if isinstance(value, (int, float, str, bytes, bool)):
        return True
    elif isinstance(value, (list, tuple, set)):
        return all(is_basic_datatype(v) for v in value)
    elif isinstance(value, dict):
        return all(
            is_basic_datatype(k) and is_basic_datatype(v) for k, v in value.items()
        )
    return False