code: def url_to_path(url):
      # type: (str) -> ByteString
      
      from .misc import to_bytes
  
      assert is_file_url(url), "Only file: urls can be converted to local paths"
      _, netloc, path, _, _ = urllib_parse.urlsplit(url)
      # Netlocs are UNC paths
      if netloc:
          netloc = "\\\\" + netloc
  
      path = urllib_request.url2pathname(netloc + path)
      return to_bytes(path, encoding="utf-8")
docs: Convert a valid file url to a local filesystem path
  
      Follows logic taken from pip's equivalent function