Python 2.7x and 3.xx compatibility fixes

Change-Id: I84eb3bf7691fa867acadf9dae8c4f56a9781bf73
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/func_timer.py b/lib/func_timer.py
index e4855e7..5f83241 100644
--- a/lib/func_timer.py
+++ b/lib/func_timer.py
@@ -86,7 +86,11 @@
         try:
             gp.lprint_executing()
             gp.lprint_var(self.__child_pid)
-        except AttributeError:
+        except (AttributeError, KeyError):
+            # NOTE: In python 3, this code fails with "KeyError:
+            # ('__main__',)" when calling functions like lprint_executing that
+            # use inspect.stack() during object destruction.  No fixes found
+            # so tolerating the error.
             pass
 
         # If self.__child_pid is 0, then we are either running as the child
@@ -189,9 +193,11 @@
             self.__time_out = kwargs['time_out']
             del kwargs['time_out']
             # Convert "none" string to None.
-            if type(self.__time_out) in (str, unicode)\
-               and self.__time_out.lower() == "none":
-                self.__time_out = None
+            try:
+                if self.__time_out.lower() == "none":
+                    self.__time_out = None
+            except AttributeError:
+                pass
             if self.__time_out is not None:
                 self.__time_out = int(self.__time_out)
                 # Ensure that time_out is non-negative.