Add __getstate__ and __setstate__ to support pickling

Pretty straightforward change: implement __{get,set}state__ so we can use the pickle module as this class uses __slots__