Move and rename write_header() to ProfileStorage.get_header()
Move and rename write_header() to ProfileStorage.get_header()
As a preparation, change change_profile_flags() to use ProfileStorage, and replace some regex usage with startswith() to make the code easier to read and (probably) more performant.
See the individual commits for details.