Write the configuration to a file. Use the correct order of values.

def write_to_file(self, filename):
        """ Write the configuration to a file. Use the correct order of values.
        """
        fid = open(filename, 'w')

        for key in self.key_order:
            if(key == -1):
                fid.write('\n')
            else:
                fid.write('{0}\n'.format(self[key]))

        fid.close()