code: def normalize(url):
      
      url = url.strip()
      if url == '':
          return ''
      parts = split(url)
      if parts.scheme:
          netloc = parts.netloc
          if parts.scheme in SCHEMES:
              path = normalize_path(parts.path)
          else:
              path = parts.path
      # url is relative, netloc (if present) is part of path
      else:
          netloc = parts.path
          path = ''
          if '/' in netloc:
              netloc, path_raw = netloc.split('/', 1)
              path = normalize_path('/' + path_raw)
      username, password, host, port = split_netloc(netloc)
      host = normalize_host(host)
      port = _normalize_port(parts.scheme, port)
      query = normalize_query(parts.query)
      fragment = normalize_fragment(parts.fragment)
      return construct(URL(parts.scheme, username, password, None, host, None,
                           port, path, query, fragment, None))
docs: Normalize a URL.
  
      >>> normalize('hTtp://ExAMPLe.COM:80')
      'http://example.com/'