class PickalableSWIG:

    def __setstate__(self, state):
        self.__init__(*state['args'])

def __getstate__(self):
    return {'args': self.args}
How to make my SWIG extension module work with Pickle?