General library for magnetic file writing/reading in Python