<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_opener(self, protocol):
 # type: (Text) -> Opener """Get the opener class associated to a given protocol. Arguments: protocol (str):
 A filesystem protocol. Returns: Opener: an opener instance. Raises: ~fs.opener.errors.UnsupportedProtocol: If no opener could be found for the given protocol. EntryPointLoadingError: If the returned entry point is not an `Opener` subclass or could not be loaded successfully. """

        protocol = protocol or self.default_opener

        if self.load_extern:
            entry_point = next(
                pkg_resources.iter_entry_points("fs.opener", protocol), None
            )
        else:
            entry_point = None

        # If not entry point was loaded from the extensions, try looking
        # into the registered protocols
        if entry_point is None:
            if protocol in self._protocols:
                opener_instance = self._protocols[protocol]
            else:
                raise UnsupportedProtocol(
                    "protocol '{}' is not supported".format(protocol)
                )

        # If an entry point was found in an extension, attempt to load it
        else:
            try:
                opener = entry_point.load()
            except Exception as exception:
                raise EntryPointError(
                    "could not load entry point; {}".format(exception)
                )
            if not issubclass(opener, Opener):
                raise EntryPointError("entry point did not return an opener")

            try:
                opener_instance = opener()
            except Exception as exception:
                raise EntryPointError(
                    "could not instantiate opener; {}".format(exception)
                )

        return opener_instance