How do I enforce consistent uid/gid's across cluster, including legacy servers?

The question was presented on the IRC channel this afternoon. This post is intended to show how I answered that question for our company's network. The script below is how I implemented the advise which balder offered on the IRC channel to this question.

I have found that it is better to bite the bullet and enforce consistent uid/gid's across the cluster, including on the legacy servers, than to struggle against the issues presented by a failure to do so.