def save(self, fname):
    d = {}
    d['total'] = self.total
    d['d'] = {}
    for (k, v) in self.d.items():
        d['d'][k] = v.__dict__
    if (sys.version_info[0] == 3):
        fname = (fname + '.3')
    marshal.dump(d, open(fname, 'wb'))
def save(self, fname):
    d = {}
    d['total'] = self.total
    d['d'] = {}
    for (k, v) in self.d.items():
        d['d'][k] = v.__dict__
    if (sys.version_info[0] == 3):
        fname = (fname + '.3')
    marshal.dump(d, open(fname, 'wb'))