How to set and import extra path into python via "pyvenv.cfg" and "<package>.pth"

I ran across C:\Program Files\LibreOffice\program\python-core-3.8.16\lib\site.py today.
It is for adding extra paths to python sys.path and talks about how to use pyvenv.cfg and <package>.pth files.

I want to understand how this works so I can use it in Windows and Linux. Does anyone have any understanding or example for this that they can share with me?

Below is the first part of the doc string for the site.py. I am just not clear on how it works.

"""
Append module search paths for third-party packages to sys.path.

****************************************************************
* This module is automatically imported during initialization. *
****************************************************************

This will append site-specific paths to the module search path.  On
Unix (including Mac OSX), it starts with sys.prefix and
sys.exec_prefix (if different) and appends
lib/python<version>/site-packages.
On other platforms (such as Windows), it tries each of the
prefixes directly, as well as with lib/site-packages appended.  The
resulting directories, if they exist, are appended to sys.path, and
also inspected for path configuration files.

If a file named "pyvenv.cfg" exists one directory above t,
sys.prefix and sys.exec_prefix are set to that directory and
it is also checked for site-packages (sys.base_prefix and
sys.base_exec_prefix will always be the "real" prefixes of the Python
installation). If "pyvenv.cfg" (a bootstrap configuration file) contains
the key "include-system-site-packages" set to anything other than "false"
(case-insensitive), the system-level prefixes will still also be
searched for site-packages; otherwise they won't.

All of the resulting site-specific directories, if they exist, are
appended to sys.path, and also inspected for path configuration
files.

...
"""

python docs: https://docs.python.org/3/library/site.html?highlight=site#module-site