Use importlib.util to replace imp

Since the imp module is deprecated and scheduled for removal in
Python 3.12 in favor of importlib, update the relevant libraries to
resolve any ModuleNotFoundError issues with Python 3.12.

Changes:
- use import importlib.util instead of import imp

Tested:
- Ran basic test pass with Python 3.10 and 3.12.

Change-Id: I25dde939dd25268b2ae329b0121858bec20ed03c
Signed-off-by: Brian Ma <chma0@nuvoton.com>
diff --git a/lib/logging_utils.py b/lib/logging_utils.py
index 4cd1898..92160cd 100644
--- a/lib/logging_utils.py
+++ b/lib/logging_utils.py
@@ -4,7 +4,7 @@
 Provide useful error log utility keywords.
 """
 
-import imp
+import importlib.util
 import os
 import sys
 
@@ -12,7 +12,9 @@
 from robot.libraries.BuiltIn import BuiltIn
 
 base_path = (
-    os.path.dirname(os.path.dirname(imp.find_module("gen_robot_print")[1]))
+    os.path.dirname(
+        os.path.dirname(importlib.util.find_spec("gen_robot_print").origin)
+    )
     + os.sep
 )
 sys.path.append(base_path + "data/")