Tweaks for python3

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
diff --git a/src/registry_tables_generator/registry_tables_generator.py b/src/registry_tables_generator/registry_tables_generator.py
index 7b0e55e..e755315 100755
--- a/src/registry_tables_generator/registry_tables_generator.py
+++ b/src/registry_tables_generator/registry_tables_generator.py
@@ -111,7 +111,7 @@
   # Get the idna representation of the rule. See
   # http://en.wikipedia.org/wiki/Internationalized_domain_name for
   # more information.
-  return [unicode(line.strip(), 'utf-8').encode('idna')
+  return [unicode(line.strip()).encode('idna')
           for line in infile
           if line.strip() and not line.strip().startswith('//')]
 
@@ -132,7 +132,7 @@
   """
   trie = trie_node.TrieNode()
   for rule in rules:
-    hostname_parts = rule.split('.')
+    hostname_parts = str(rule).split('.')
     node = trie
     for hostname_part in reversed(hostname_parts):
       node = node.GetOrCreateChild(hostname_part)
@@ -164,7 +164,7 @@
   """
   trie = trie_node.TrieNode()
   for rule in rules:
-    hostname_parts = rule.split('.')
+    hostname_parts = str(rule).split('.')
     for hostname_part in hostname_parts:
       node = trie
       # NOTE: iterating characters in reverse order assumes that there
@@ -185,7 +185,6 @@
     out_file: file to write registry suffix string tables to
     out_test_file: file to write registry suffix test cases to
   """
-
   rules = _ReadRulesFromFile(in_file)
 
   hostname_part_trie = _BuildHostnameSuffixTrie(rules)
@@ -262,8 +261,7 @@
     argv[3]: out_test_file: the file to write registry suffix test cases to
   """
   if len(argv) != 4:
-    print >> sys.stderr, (
-      'Usage: gen_string_table.py in_file out_file, out_test_file')
+    sys.stderr.writelines(['Usage: gen_string_table.py in_file out_file, out_test_file'])
     return 1
 
   in_filename = argv[1]
diff --git a/src/registry_tables_generator/test_table_builder.py b/src/registry_tables_generator/test_table_builder.py
index ddabcd6..bad1825 100644
--- a/src/registry_tables_generator/test_table_builder.py
+++ b/src/registry_tables_generator/test_table_builder.py
@@ -37,7 +37,7 @@
     rules).
     """
     for rule in rules:
-      parts = rule.split('.')
+      parts = str(rule).split('.')
       first = parts[0]
       host = 'example'
       if first == '*':