save settings to a file. Return True/False on success/failure

def save(self, filename):
        '''save settings to a file. Return True/False on success/failure'''
        try:
            f = open(filename, mode='w')
        except Exception:
            return False
        for k in self.list():
            f.write("%s=%s\n" % (k, self.get(k)))
        f.close()
        return True