BUG: didn't write out supplied prefix when writing out dictionary

Also didn’t put a comma at the end of each dictionary entry in the
Python approach
Avoid NPEs when creating datasets. Also write out order that indivdiual dictionaries appear in Compound Dictionary
Whitespace changes