A great application for Django is django-tagging. However using tagging and removing the items to which they refer will lead to a lot of unused Tags and TaggedItems lying around.
So I wrote a small function to prune Django. There's a good chance I'll clean up the code for submission to the django-tagging codebase.