Issue #8514: Add os.fsencode() function (Unix only): encode a string to bytes
for use in the file system, environment variables or the command line.
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 577c600..1d4b1e1 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -155,6 +155,17 @@
    These functions are described in :ref:`os-file-dir`.
 
 
+.. function:: fsencode(value)
+
+   Encode *value* to bytes for use in the file system, environment variables or
+   the command line. Uses :func:`sys.getfilesystemencoding` and
+   ``'surrogateescape'`` error handler for strings and returns bytes unchanged.
+
+   Availability: Unix.
+
+   .. versionadded:: 3.2
+
+
 .. function:: get_exec_path(env=None)
 
    Returns the list of directories that will be searched for a named