Could be done, but nothing is EVER simple regarding IPv6. :) What about EUI-64? Any special cases regarding TEREDO, ORCHID2, 6to4 addressing scheme (NOT the same as NAT64!), etc...?
Nevertheless, something like this could be an option.
I also use Tcl quite a lot for some pretty sophisticated software. (And it's not embedded! It seems most surviving Tcl programmers are using it as an embedded scripting language.)
https://github.com/kkovacs/kkrc/blob/ecff1f65d5ccfa24d5f6695...
:)