def cleanUp(self):
        """ 
        Clean up the session for objects that can't be cpickled: 
        1. parsed node trees with weakrefs cannot be cpickled;
        
        python v 2.4 raises a TypeError instead of pickle.UnpickleableError, so catch this exception
        
        >>> from xpyth.xmlparser import XMLParser
        >>> parsed_xml = XMLParser().parse('<a>**c**</a>')
        >>> parsed_xml
        <a No parent >
        >>> s = Session('1234')
        >>> s.set('nodewithweakparent', parsed_xml)
        <a No parent >
        """

        for d in self.data:
            for key, value in d.items():
                try:
                    pickle.dumps(value, 1)
                except (pickle.UnpickleableError, pickle.PicklingError, TypeError, __HOLE__): #@UndefinedVariable
                    del d[key]
dataset/ETHPy150Open petrvanblokland/Xierpa3/xierpa3/toolbox/session/session.py/Session.cleanUp