Python3: fix bytes/str issues

In Python 3, tempfile.NamedTemporaryFile().write() takes bytes as input,
not a text string. Make sure we use bytes in the tests. Also, completely
fix test_get_template_contents_file by passing a string to
template_utils.get_template_contents().

Change-Id: I49070b32e44a405740e3150ccc357ec375f41e64
Merge "Python3: fix bytes/str issues"