def cleanup(cls, ref):
        cls.cleanups += 1 # collect stats

        w = cls._refs.get(ref, None)
        del cls._refs[ref]
        if not w:
            return
        widget, wcls, size, focus = w
        sizes = cls._widgets.get(widget, None)
        if not sizes:
            return
        try:
            del sizes[(wcls, size, focus)]
        except __HOLE__:
            pass
        if not sizes:
            try:
                del cls._widgets[widget]
                del cls._deps[widget]
            except KeyError:
                pass
dataset/ETHPy150Open AnyMesh/anyMesh-Python/example/urwid/canvas.py/CanvasCache.cleanup