I wrote a similar script for @dji (I have since tweaked it since its original concept since you can't have a perfect umbreon and a perfect espeon from the same trainer).
https://repl.it/@kbatman/ColoStarterGenerator
https://repl.it/@kbatman/PerfectColoStarters
The problem he has now is that he has a TID/SID that he wants, there are issues with changing his TID/SID in his save to the target.