Acquia's drush tools do a good job of this, actually.