Introduce an encoding helper and exercise it with some non-ascii paths in the rand module tests.

Does it make sense?  I dunno.
diff --git a/OpenSSL/rand.py b/OpenSSL/rand.py
index 311c00b..7592fe0 100644
--- a/OpenSSL/rand.py
+++ b/OpenSSL/rand.py
@@ -11,7 +11,8 @@
 from OpenSSL._util import (
     ffi as _ffi,
     lib as _lib,
-    exception_from_error_queue as _exception_from_error_queue)
+    exception_from_error_queue as _exception_from_error_queue,
+    path_string as _path_string)
 
 
 class Error(Exception):
@@ -136,8 +137,7 @@
                      to read the entire file
     :return: The number of bytes read
     """
-    if not isinstance(filename, (str, _builtin_bytes)):
-        raise TypeError("filename must be a string")
+    filename = _path_string(filename)
 
     if maxbytes is _unspecified:
         maxbytes = -1
@@ -155,9 +155,7 @@
     :param filename: The file to write data to
     :return: The number of bytes written
     """
-    if not isinstance(filename, (str, _builtin_bytes)):
-        raise TypeError("filename must be a string")
-
+    filename = _path_string(filename)
     return _lib.RAND_write_file(filename)