class_docstr: So we could provide handling for URLs with corresponding credentials
  and specific (reusable) downloader.  Internally it contains
  Providers and interfaces them based on a given URL.  Each provider
  in turn takes care about associated with it Downloader.
class_docstr_tok: ["So","we","could","provide","handling","for","URLs","with","corresponding","credentials","and","specific","(","reusable",")","downloader",".","Internally","it","contains","Providers","and","interfaces","them","based","on","a","given","URL",".","Each","provider","in","turn","takes","care","about","associated","with","it","Downloader","."]
docstr: Given a URL returns matching provider
          
code: def get_provider(self, url, only_nondefault=False, return_all=False):
      """Given a URL returns matching provider"""
  
      # Range backwards to ensure that more locally defined
      # configuration wins in conflicts between url_re
      matching_providers = []
      for provider in self._providers[::-1]:
          for url_re in provider.url_res:
              try:
                  if re.match(url_re, url):
                      lgr.debug(
                          "Returning provider %s for url %s",
                          provider,
                          url,
                      )
                      matching_providers.append(provider)
              except re.error:
                  lgr.warning(
                      "Invalid regex %s in provider %s"
                      % (url_re, provider.name)
                  )
  
      if matching_providers:
          if return_all:
              return matching_providers
          if len(matching_providers) > 1:
              lgr.warning(
                  "Multiple providers matched for %s, using the first one"
                  % url
              )
          return matching_providers[0]
  
      if only_nondefault:
          return None
  
      # None matched -- so we should get a default one per each of used
      # protocols
      scheme = Provider.get_scheme_from_url(url)
      if scheme not in self._default_providers:
          lgr.debug("Initializing default provider for %s", scheme)
          self._default_providers[scheme] = Provider(
              name="", url_res=["%s://.*" % scheme]
          )
      provider = self._default_providers[scheme]
      lgr.debug(
          "No dedicated provider, returning default one for %s: %s",
          scheme,
          provider,
      )
      return provider
  
imports: from glob import glob
  from logging import getLogger
  import re
  from os.path import dirname, abspath, join
  from urllib.parse import urlparse
  from .base import NoneAuthenticator, NotImplementedAuthenticator
  from .http import HTMLFormAuthenticator, HTTPAnonBearerTokenAuthenticator, HTTPAuthAuthenticator, HTTPBasicAuthAuthenticator, HTTPDigestAuthAuthenticator, HTTPBearerTokenAuthenticator, HTTPDownloader
  from .s3 import S3Authenticator, S3Downloader
  from .shub import SHubDownloader
  from configparser import ConfigParser
  from datalad.support.external_versions import external_versions
  from datalad.support.network import RI
  from datalad.support import path
  from datalad.utils import auto_repr, ensure_list_from_str, get_dataset_root, Path
  from ..interface.common_cfg import dirs
  from datalad.downloaders import CREDENTIAL_TYPES
label_desc: Use image node_id 13 for calling the Providers obj's underlying member method code with example usage: obj.get_provider(url, only_nondefault, return_all) and returns: provider, matching_providers, None, matching_providers