def _prefer_package(self, package):
if isinstance(package, str) and package != self.imported:<EOL><INDENT>if package not in self.packages:<EOL><INDENT>raise ValueError(<EOL>f"<STR_LIT>"<EOL>f"<STR_LIT>"<EOL>)<EOL><DEDENT>if hasattr(self, "<STR_LIT>"):<EOL><INDENT>del self._handler<EOL><DEDENT>self._imported = self._discover_import(prefer=package)<EOL>return package<EOL><DEDENT>return self.imported<EOL>
Prefer a serializtion handler over other handlers.

        :param str package: The name of the package to use
        :raises ValueError: When the given package name is not one of the available
            supported serializtion packages for this handler
        :return: The name of the serialization handler
        :rtype: str