def _urlunsplit(scheme=None, netloc=None, path=None, query=None, fragment=None):
 if ((not scheme) or (not netloc)):
  scheme = None
  netloc = None
 if path:
  path = urllib.quote(_to_utf8(path))
 if (query and (not isinstance(query, basestring))):
  if isinstance(query, dict):
   query = query.iteritems()
  query = urllib.urlencode(sorted(query))
 if fragment:
  fragment = urllib.quote(_to_utf8(fragment))
 return urlparse.urlunsplit((scheme, netloc, path, query, fragment))

def _urlunsplit ( scheme = None , netloc = None , path = None , query = None , fragment = None ) : if ( ( not scheme ) or ( not netloc ) ) : scheme = None netloc = None if path : path = urllib . quote ( _to_utf8 ( path ) ) if ( query and ( not isinstance ( query , basestring ) ) ) : if isinstance ( query , dict ) : query = query . iteritems ( ) query = urllib . urlencode ( sorted ( query ) ) if fragment : fragment = urllib . quote ( _to_utf8 ( fragment ) ) return urlparse . urlunsplit ( ( scheme , netloc , path , query , fragment ) )
like urlparse .