'To keep key objects platform-independent, the key data is
converted to standard Python long integers before being
written out.  It will then be reconverted as necessary on
restoration.'

def __getstate__(self):

    d = self.__dict__
    for key in self.keydata:
        if d.has_key(key):
            d[key] = long(d[key])
    return d
