We have a custom plugin that does this, but since I don't feel like releasing it under the GPL, you'll just have to take my word when I say it's the best thing in the Intarweb, ever.

Might make a separate script of it.. some time in the distant future.