I can't find any existing script which can handle all of the conditions. I think this would need a new script, but is unlikely to get one any time soon given that the conditions would no longer be allowed so the re-usability of the script is very limited.