def __del__(self):
<EOL>if self.__class__._lib is None:<EOL><INDENT>assert self.__class__._refcount == <NUM_LIT:0><EOL>return<EOL><DEDENT>assert self.__class__._refcount >= <NUM_LIT:1><EOL>self.__class__._refcount -= <NUM_LIT:1><EOL>if self._callback_wrapper is not None:<EOL><INDENT>for cid in self._callback_wrapper.get_callback_ids():<EOL><INDENT>try:<EOL><INDENT>self.tdUnregisterCallback(cid)<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>if self.__class__._refcount != <NUM_LIT:0>:<EOL><INDENT>return<EOL><DEDENT>if hasattr(self.__class__._lib, "<STR_LIT>"):<EOL><INDENT>self.__class__._lib.tdClose()<EOL><DEDENT>self.__class__._lib = None<EOL>
Close and unload the Telldus core library.

        Any callback set up is removed.

        The underlaying library is only closed and unloaded if this is the last
        instance sharing the same underlaying library instance.