Find a :class:`plaster.ILoader` object capable of handling ``config_uri``.

    :param config_uri: Anything that can be parsed by
        :func:`plaster.parse_uri`.

    :param protocols: Zero or more :term:`loader protocol` identifiers that
        the loader must implement to match the desired ``config_uri``.

    :returns: A :class:`plaster.ILoader` object.
    :raises plaster.LoaderNotFound: If no loader could be found.
    :raises plaster.MultipleLoadersFound: If multiple loaders match the
        requested criteria. If this happens, you can disambiguate the lookup
        by appending the package name to the scheme for the loader you wish
        to use. For example if ``ini`` is ambiguous then specify
        ``ini+myapp`` to use the ini loader from the ``myapp`` package.

def get_loader(config_uri, protocols=None):
    """
    Find a :class:`plaster.ILoader` object capable of handling ``config_uri``.

    :param config_uri: Anything that can be parsed by
        :func:`plaster.parse_uri`.

    :param protocols: Zero or more :term:`loader protocol` identifiers that
        the loader must implement to match the desired ``config_uri``.

    :returns: A :class:`plaster.ILoader` object.
    :raises plaster.LoaderNotFound: If no loader could be found.
    :raises plaster.MultipleLoadersFound: If multiple loaders match the
        requested criteria. If this happens, you can disambiguate the lookup
        by appending the package name to the scheme for the loader you wish
        to use. For example if ``ini`` is ambiguous then specify
        ``ini+myapp`` to use the ini loader from the ``myapp`` package.

    """
    config_uri = parse_uri(config_uri)
    requested_scheme = config_uri.scheme

    matched_loaders = find_loaders(requested_scheme, protocols=protocols)

    if len(matched_loaders) < 1:
        raise LoaderNotFound(requested_scheme, protocols=protocols)

    if len(matched_loaders) > 1:
        raise MultipleLoadersFound(
            requested_scheme, matched_loaders, protocols=protocols)

    loader_info = matched_loaders[0]
    loader = loader_info.load(config_uri)
    return loader