With large projects that have hundreds of textures, it can be very difficult to deal with them in the UV image editor using the following little drop-down menu.

The best solution that I've come with so far is to modify the UV Image Editor code using some code from the Sculpt and Texture Paint section which is very helpful but it's still difficult to tell if something is in use and it has to be reopened every time something is selected and deleted.
(It now looks like the following in case anyone is interested. You can do this by menu-clicking the image icon next to New and Open then selecting edit source and changing the following line in space_image.py
layout.template_ID(sima, "image", new="image.new", open="image.open")
to be
*layout.template_ID_preview(sima, "image", new="image.new", open="image.open", rows=8, cols=16*)

This question deals with deleting textures and it's what I already do. But it's time consuming and very difficult to find the unused textures when there are a couple hundred of them, especially if the drop down menu has to be reopened and searched for everyone one of them.
So my question is the this:
Is there a way to delete all the unused textures using a Python script?
I have found one script that does not work very well. Sometimes it does and sometimes it does not.
This gives the impression that there is something going on behind the scenes when it comes to how textures are considered to be in use.
By the way, I don't use Fake User or pack images so this may simplify things a bit.
1) That should clear out all datablocks with no users. – gandalf3 Jul 08 '14 at 17:46