__getstate__ and __setstate__ method for pickling.