def _parse_proxy(proxy):
 (scheme, r_scheme) = splittype(proxy)
 if (not r_scheme.startswith('/')):
  scheme = None
  authority = proxy
 else:
  if (not r_scheme.startswith('//')):
   raise ValueError(('proxy URL with no authority: %r' % proxy))
  end = r_scheme.find('/', 2)
  if (end == (-1)):
   end = None
  authority = r_scheme[2:end]
 (userinfo, hostport) = splituser(authority)
 if (userinfo is not None):
  (user, password) = splitpasswd(userinfo)
 else:
  user = password = None
 return (scheme, user, password, hostport)

def _parse_proxy ( proxy ) : ( scheme , r_scheme ) = splittype ( proxy ) if ( not r_scheme . startswith ( '/' ) ) : scheme = None authority = proxy else : if ( not r_scheme . startswith ( '//' ) ) : raise ValueError ( ( 'proxy URL with no authority: %r' % proxy ) ) end = r_scheme . find ( '/' , 2 ) if ( end == ( - 1 ) ) : end = None authority = r_scheme [ 2 : end ] ( userinfo , hostport ) = splituser ( authority ) if ( userinfo is not None ) : ( user , password ) = splitpasswd ( userinfo ) else : user = password = None return ( scheme , user , password , hostport )
return given a url or an authority .