use isinstance
diff --git a/Lib/imghdr.py b/Lib/imghdr.py
index 2fbc966..233ea33 100644
--- a/Lib/imghdr.py
+++ b/Lib/imghdr.py
@@ -8,7 +8,7 @@
 
 def what(file, h=None):
     if h is None:
-        if type(file) == type(''):
+        if isinstance(file, basestring):
             f = open(file, 'rb')
             h = f.read(32)
         else: