def _build_package_finder(self, options, session):
        """
        Create a package finder appropriate to this list command.
        """
        link_collector = make_link_collector(session, options=options)

        # Pass allow_yanked=False to ignore yanked versions.
        selection_prefs = SelectionPreferences(
            allow_yanked=False,
            allow_all_prereleases=options.pre,
        )

        return PackageFinder.create(
            link_collector=link_collector,
            selection_prefs=selection_prefs,
        )

        Create a package finder appropriate to this list command.
        
product/gradle-plugin/src/main/python/pip/_internal/commands/list.py