def get_variant_slice(self, package_name, range_):
variant_list = self.variant_lists.get(package_name)<EOL>if variant_list is None:<EOL><INDENT>variant_list = _PackageVariantList(package_name, self.solver)<EOL>self.variant_lists[package_name] = variant_list<EOL><DEDENT>entries = variant_list.get_intersection(range_)<EOL>if not entries:<EOL><INDENT>return None<EOL><DEDENT>slice_ = _PackageVariantSlice(package_name,<EOL>entries=entries,<EOL>solver=self.solver)<EOL>return slice_<EOL>
Get a list of variants from the cache.

        Args:
            package_name (str): Name of package.
            range_ (`VersionRange`): Package version range.

        Returns:
            `_PackageVariantSlice` object.