Python 3: fix test_template_utils.py

The mock for urlopen().read() should return bytes in Python 3, not text
strings. Do this and fix everything that's needed to make the tests work.

Change-Id: Ief7c2efff81238c99db21ae7fff86d15f210a75f
Merge "Python 3: fix test_template_utils.py"