def get_virtualenv_lib_path(virtualenv_path: str) -> str:
    """Returns the path to a virtualenv's lib/python3.* directory."""
    if not (virtualenv_path and os.path.isdir(virtualenv_path)):
        raise OSError(
            f"virtualenv_path must be an existing directory. virtualenv_path={virtualenv_path}"
        )

    pack_virtualenv_lib_path = os.path.join(virtualenv_path, "lib")

    virtualenv_directories = os.listdir(pack_virtualenv_lib_path)
    virtualenv_directories = [
        dir_name
        for dir_name in virtualenv_directories
        if fnmatch.fnmatch(dir_name, "python*")
    ]

    return os.path.join(pack_virtualenv_lib_path, virtualenv_directories[0])
Returns the path to a virtualenv's lib/python3.* directory.
st2common/st2common/util/sandboxing.py