Re #7547. Move dgs_utils.py to python v2 API.

This was harder than foreseen because of all the unicode around here,
which our Python API really doesn't like!
Merge remote-tracking branch 'origin/feature/7547_dgs_utils_to_v2'