#NEWLINE# def parse_backend_uri( backend_uri ) : #NEWLINE# #INDENT# '\n    Converts the "backend_uri" into a host and any extra params that are\n    required for the backend. Returns a (host, params) tuple.\n    ' #NEWLINE# backend_uri_sliced = backend_uri . split ( '://' ) #NEWLINE# if ( len ( backend_uri_sliced ) > 2 ) : #NEWLINE# #INDENT# raise InvalidCacheBackendError ( "Backend URI can't have more than one scheme://" ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( backend_uri_sliced ) == 2 ) : #NEWLINE# #INDENT# rest = backend_uri_sliced [ 1 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# rest = backend_uri_sliced [ 0 ] #NEWLINE# #UNINDENT# #UNINDENT# host = rest #NEWLINE# qpos = rest . find ( '?' ) #NEWLINE# if ( qpos != ( - 1 ) ) : #NEWLINE# #INDENT# params = dict ( parse_qsl ( rest [ ( qpos + 1 ) : ] ) ) #NEWLINE# host = rest [ : qpos ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# params = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if host . endswith ( '/' ) : #NEWLINE# #INDENT# host = host [ : ( - 1 ) ] #NEWLINE# #UNINDENT# return ( host , params )