Catch event before automatic extension re-initialization

Hello,
please may I ask if there is a way to somehow catch event before Python extension is re-initialized? I am trying to write some simple observer pattern on top of extension objects in TD and I can’t seem to figure out how to automatically unsubscribe observer objects before subject object is destroyed (during re-initialization). Thanks.