'Collect state related to the exception which occurred, discarding
state which cannot reasonably be serialized.'

def getStateToCopy(self):

    state = self.__dict__.copy()
    state['tb'] = None
    state['frames'] = []
    state['stack'] = []
    state['value'] = str(self.value)
    if isinstance(self.type, bytes):
        state['type'] = self.type
    else:
        state['type'] = reflect.qual(self.type).encode('utf-8')
    if self.unsafeTracebacks:
        state['traceback'] = self.getTraceback()
    else:
        state['traceback'] = 'Traceback    unavailable\n'
    return state
