Fixes __getstate__ for session pickling

As noted in #1088, sessions cannot be pickled currently. I ran into this when implementing some multiprocessing functionality for a project. 

Here, I'm just checking for `__attrs__` prior to trying to iterate over it. It does occur to me that if `__attrs__` is removed permanently, maybe the `__getstate__` method should just be stubbed out to preserve pickling functionality.