diff --git a/pcl_expect.py b/pcl_expect.py
index 968992cbcd9f607b4b04157360fa090d1efe54b2..7641ae4eae69f0cc26ee50bb99fad9d027da58cf 100644
--- a/pcl_expect.py
+++ b/pcl_expect.py
@@ -7,7 +7,6 @@ import select
 import sets
 import sys
 import telnetlib
-import types
 
 #
 # Global variables.  The user are supposed to change these.
@@ -115,7 +114,7 @@ class spawn(expectable):
             settings = f.read()
             f.close()
 
-        if isinstance(cmd, types.StringTypes):
+        if isinstance(cmd, basestring):
             cmd = cmd.split(" ")
         (r, w) = os.pipe()
         set_cloexec_flag(w)
@@ -268,7 +267,7 @@ class impl:
 
         # Doing this compilation again and again could be a problem.
         # I rely on the cache in module re.  I hope it exists...
-        if isinstance(regexp, types.StringTypes):
+        if isinstance(regexp, basestring):
             regexp = re.compile(regexp)
 
         match = regexp.search(exp.buffer())