def _append_state(self, obj):
            '''Stores undo state by pickling it into a temporary file, which is kept open
            and appended to the state buffer'''
            if os.environ.get('ENABLE_UNDO_TEMPFILES', '0') == '1':
                f = tempfile.TemporaryFile()
                pickle.dump(obj, f)
                f.seek(0)
                self.undoList.append(f)
            else:
                self.undoList.append(pickle.dumps(obj))
Stores undo state by pickling it into a temporary file, which is kept open
            and appended to the state buffer
durdraw/durdraw_undo.py