This is a very useful script by jaydansand that I found on gist.github. Keeping it handy here.
See the original gist