def __setstate__(self,state):
        ''' Load the state for pickling. '''
        self.model = eval(state['model_class']+"()")
        filename = tempfile.mktemp(suffix='.mod', prefix='tmp')
        open(filename,'wb').write(state['model_data'])
        self.model.load(filename)
        os.remove(filename)
        for key,value in state.iteritems():
            if key not in ('model_data','model_class'):
                setattr(self,key,value)
dataset/ETHPy150Open bolme/pyvision/src/pyvision/ml/opencv_ml.py/StatsModelWrapper.__setstate__/original