code: def urljoin(base_url, url, allow_fragments=True):
      '''Join URLs like ``urllib.parse.urljoin`` but allow scheme-relative URL.'''
      if url.startswith('//') and len(url) > 2:
          scheme = base_url.partition(':')[0]
          if scheme:
              return urllib.parse.urljoin(
                  base_url,
                  '{0}:{1}'.format(scheme, url),
                  allow_fragments=allow_fragments
              )
  
      return urllib.parse.urljoin(
          base_url, url, allow_fragments=allow_fragmentsf urljoin(base_url, url, allow_fragments=True):
      '''Join URLs like ``urllib.parse.urljoin`` but allow scheme-relative URL.'''
      if url.startswith('//') and len(url) > 2:
          scheme = base_url.partition(':')[0]
          if scheme:
              return urllib.parse.urljoin(
                  base_url,
                  '{0}:{1}'.format(scheme, url),
                  allow_fragments=allow_fragments
              )
  
      return urllib.parse.urljoin(
          base_url, url, allow_fragments=allow_fragments)
docs: Join URLs like ``urllib.parse.urljoin`` but allow scheme-relative URL.