code: def verify_ria_url(url, cfg):
      """Verify and decode ria url
  
      Expects a ria-URL pointing to a RIA store, applies rewrites and tries to
      decode potential host and base path for the store from it. Additionally
      raises if `url` is considered invalid.
  
      ria+ssh://somehost:/path/to/store
      ria+file:///path/to/store
  
      Parameters
      ----------
      url : str
        URL to verify an decode.
      cfg : dict-like
        Configuration settings for rewrite_url()
  
      Raises
      ------
      ValueError
  
      Returns
      -------
      tuple
        (host, base-path, rewritten url)
        `host` is not just a hostname, but is a stub URL that may also contain
        username, password, and port, if specified in a given URL.
        `base-path` is the unquoted path component of the url
      """
      from datalad.config import rewrite_url
      from datalad.support.network import URL
  
      if not url:
          raise ValueError("Got no URL")
  
      url = rewrite_url(cfg, url)
      url_ri = URL(url)
      if not url_ri.scheme.startswith("ria+"):
          raise ValueError("Missing ria+ prefix in final URL: %s" % url)
      if url_ri.fragment:
          raise ValueError(
              "Unexpected fragment in RIA-store URL: %s"
              % url_ri.fragment
          )
      protocol = url_ri.scheme[4:]
      if protocol not in ["ssh", "file", "http", "https"]:
          raise ValueError(
              "Unsupported protocol: %s. "
              "Supported: ssh, file, http(s)" % protocol
          )
  
      host = "{proto}://{user}{pdlm}{passwd}{udlm}{host}{portdlm}{port}".format(
          proto=protocol,
          user=url_ri.username or "",
          pdlm=":" if url_ri.password else "",
          passwd=url_ri.password or "",
          udlm="@" if url_ri.username else "",
          host=url_ri.hostname or "",
          portdlm=":" if url_ri.port else "",
          port=url_ri.port or "",
      )
      # this ``!= 'file'´´ is critical behavior, if removed, it will ruin the IO
      # selection in ORARemote!!
      return (
          host if protocol != "file" else None,
          url_ri.path or "/",
          url,
      )
  
file_path: datalad/datalad/customremotes/ria_utils.py
imports: import logging
  from pathlib import Path
label_desc: Use image node_id 2 for calling a global function with example usage: verify_ria_url(url, cfg) and returns: unknown,  unknown,  url