code: def normalize_url(url):
      
      if not url:
          return url
  
      matched = _windows_path_prefix.match(url)
      if matched:
          return path2url(url)
  
      p = six.moves.urllib.parse.urlparse(url)
      if p.scheme == '':
          if p.netloc == '' and p.path != '':
              # it should be a file path
              url = path2url(os.path.abspath(url))
          else:
              raise ValueError('url should be a http-url or file path -- ' + url)
  
      return url
docs: Normalize url