def path_string(s):
if isinstance(s, binary_type):<EOL><INDENT>return s<EOL><DEDENT>elif isinstance(s, text_type):<EOL><INDENT>return s.encode(sys.getfilesystemencoding())<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>
Convert a Python string to a :py:class:`bytes` string identifying the same
path and which can be passed into an OpenSSL API accepting a filename.

:param s: An instance of :py:class:`bytes` or :py:class:`unicode`.

:return: An instance of :py:class:`bytes`.