def url_unparse(components):
 (scheme, netloc, path, query, fragment) = normalize_string_tuple(components)
 s = make_literal_wrapper(scheme)
 url = s('')
 if (netloc or (scheme and path.startswith(s('/')))):
  if (path and (path[:1] != s('/'))):
   path = (s('/') + path)
  url = ((s('//') + (netloc or s(''))) + path)
 elif path:
  url += path
 if scheme:
  url = ((scheme + s(':')) + url)
 if query:
  url = ((url + s('?')) + query)
 if fragment:
  url = ((url + s('#')) + fragment)
 return url

def url_unparse ( components ) : ( scheme , netloc , path , query , fragment ) = normalize_string_tuple ( components ) s = make_literal_wrapper ( scheme ) url = s ( '' ) if ( netloc or ( scheme and path . startswith ( s ( '/' ) ) ) ) : if ( path and ( path [ : 1 ] != s ( '/' ) ) ) : path = ( s ( '/' ) + path ) url = ( ( s ( '//' ) + ( netloc or s ( '' ) ) ) + path ) elif path : url += path if scheme : url = ( ( scheme + s ( ':' ) ) + url ) if query : url = ( ( url + s ( '?' ) ) + query ) if fragment : url = ( ( url + s ( '#' ) ) + fragment ) return url
the reverse operation to :meth:url_parse .