def _parse_relative_url(relative_url):
 if (not relative_url):
  raise _RelativeUrlError('Relative URL is empty')
 (scheme, netloc, path, query, fragment) = urlparse.urlsplit(relative_url)
 if (scheme or netloc):
  raise _RelativeUrlError('Relative URL may not have a scheme or location')
 if fragment:
  raise _RelativeUrlError('Relative URL may not specify a fragment')
 if ((not path) or (path[0] != '/')):
  raise _RelativeUrlError('Relative URL path must start with "/"')
 return (path, query)

def _parse_relative_url ( relative_url ) : if ( not relative_url ) : raise _RelativeUrlError ( 'Relative URL is empty' ) ( scheme , netloc , path , query , fragment ) = urlparse . urlsplit ( relative_url ) if ( scheme or netloc ) : raise _RelativeUrlError ( 'Relative URL may not have a scheme or location' ) if fragment : raise _RelativeUrlError ( 'Relative URL may not specify a fragment' ) if ( ( not path ) or ( path [ 0 ] != '/' ) ) : raise _RelativeUrlError ( 'Relative URL path must start with "/"' ) return ( path , query )
parses a relative url and splits it into its path and query string .