def _get_pack_common_libs_path(self, pack_ref):
        """
        Retrieve path to the pack common lib/ directory taking git work tree path into account
        (if used).
        """
        worktree_path = self.git_worktree_path
        pack_common_libs_path = get_pack_common_libs_path_for_pack_ref(
            pack_ref=pack_ref
        )

        if not worktree_path:
            return pack_common_libs_path

        # Modify the path so it uses git worktree directory
        pack_base_path = get_pack_base_path(pack_name=pack_ref)

        new_pack_common_libs_path = pack_common_libs_path.replace(pack_base_path, "")

        # Remove leading slash (if any)
        if new_pack_common_libs_path.startswith("/"):
            new_pack_common_libs_path = new_pack_common_libs_path[1:]

        new_pack_common_libs_path = os.path.join(
            worktree_path, new_pack_common_libs_path
        )

        # Check to prevent directory traversal
        common_prefix = os.path.commonprefix([worktree_path, new_pack_common_libs_path])
        if common_prefix != worktree_path:
            raise ValueError("pack libs path is not located inside the pack directory")

        return new_pack_common_libs_path

        Retrieve path to the pack common lib/ directory taking git work tree path into account
        (if used).
        
contrib/runners/python_runner/python_runner/python_runner.py