patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 2735afa..0b71a89 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -11,6 +11,7 @@
 import gitutil
 import settings
 import terminal
+import tools
 
 # Series-xxx tags that we understand
 valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name',
@@ -249,7 +250,7 @@
             cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
             cover_cc = [m.encode('utf-8') if type(m) != str else m
                         for m in cover_cc]
-            cc_list = ', '.join([x.decode('utf-8')
+            cc_list = ', '.join([tools.ToUnicode(x)
                                  for x in set(cover_cc + all_ccs)])
             print(cover_fname, cc_list.encode('utf-8'), file=fd)