Spaces in labels of ARFF files

A common problem people have with ARFF files is that labels can only have spaces if they are enclosed in single quotes, i.e., a label such as:
 some value
should be written either
 'some value'
or
 some_value
in the file.

See single quotes in labels of ARFF files for an example using the Weka API for automatically quoting such strings.