Shorten str type checks
diff --git a/OpenSSL/rand.py b/OpenSSL/rand.py
index 1f628e8..311c00b 100644
--- a/OpenSSL/rand.py
+++ b/OpenSSL/rand.py
@@ -136,7 +136,7 @@
                      to read the entire file
     :return: The number of bytes read
     """
-    if not isinstance(filename, str) and not isinstance(filename, _builtin_bytes):
+    if not isinstance(filename, (str, _builtin_bytes)):
         raise TypeError("filename must be a string")
 
     if maxbytes is _unspecified:
@@ -155,7 +155,7 @@
     :param filename: The file to write data to
     :return: The number of bytes written
     """
-    if not isinstance(filename, str) and not isinstance(filename, _builtin_bytes):
+    if not isinstance(filename, (str, _builtin_bytes)):
         raise TypeError("filename must be a string")
 
     return _lib.RAND_write_file(filename)