code: def ByUrl(mapping):  # noqa: N802
      schemas = walk_values(Schema, mapping)
  
      def validate(data):
          if "url" not in data:
              raise Invalid("expected 'url'")
  
          parsed = urlparse(data["url"])
          # Windows absolute paths should really have scheme == "" (local)
          if (
              os.name == "nt"
              and len(parsed.scheme) == 1
              and not parsed.netloc
          ):
              return schemas[""](data)
          if not parsed.netloc:
              return schemas[""](data)
          if parsed.scheme not in schemas:
              raise Invalid(f"Unsupported URL type {parsed.scheme}://")
  
          return schemas[parsed.scheme](data)
  
      return validate
  
file_path: dvc/dvc/config_schema.py
imports: import os
  from urllib.parse import urlparse
  from funcy import once, walk_values
  from voluptuous import REMOVE_EXTRA, All, Any, Coerce, Exclusive, Invalid, Lower, Optional, Range, Schema
  from dvc.log import logger
label_desc: Use image node_id 3 for calling a global function with example usage: ByUrl(mapping) and returns: validate, schemas, schemas, schemas