def parse_backend_uri(backend_uri):
 if (backend_uri.find(':') == (-1)):
  raise InvalidCacheBackendError('Backend URI must start with scheme://')
 (scheme, rest) = backend_uri.split(':', 1)
 if (not rest.startswith('//')):
  raise InvalidCacheBackendError('Backend URI must start with scheme://')
 host = rest[2:]
 qpos = rest.find('?')
 if (qpos != (-1)):
  params = dict(parse_qsl(rest[(qpos + 1):]))
  host = rest[2:qpos]
 else:
  params = {}
 if host.endswith('/'):
  host = host[:(-1)]
 return (scheme, host, params)

def parse_backend_uri ( backend_uri ) : if ( backend_uri . find ( ':' ) == ( - 1 ) ) : raise InvalidCacheBackendError ( 'Backend URI must start with scheme://' ) ( scheme , rest ) = backend_uri . split ( ':' , 1 ) if ( not rest . startswith ( '//' ) ) : raise InvalidCacheBackendError ( 'Backend URI must start with scheme://' ) host = rest [ 2 : ] qpos = rest . find ( '?' ) if ( qpos != ( - 1 ) ) : params = dict ( parse_qsl ( rest [ ( qpos + 1 ) : ] ) ) host = rest [ 2 : qpos ] else : params = { } if host . endswith ( '/' ) : host = host [ : ( - 1 ) ] return ( scheme , host , params )
converts the "backend_uri" into a cache scheme .