parameters: (url)
return_statement: return ((host, port), prefix)
docstring: Convert provided string in 'host:port/prefix' format to it's components
  	Returns ((host, port), prefix)
docstring_summary: Convert provided string in 'host:port/prefix' format to it's components
  	Returns ((host, port), prefix)
docstring_tokens: Convert provided string in host : port / prefix format to it s components Returns (( host port ) prefix )
function: def parseUrlStr(url):
  	"""Convert provided string in 'host:port/prefix' format to it's components
  	Returns ((host, port), prefix)
  	"""
  	if not (type(url) in types.StringTypes and len(url)):
  		return (None, '')
  
  	i = url.find("://")
  	if i > -1:
  		url = url[i+3:]
  		
  	i = url.find(':')
  	if i > -1:
  		host = url[:i].strip()
  		tail = url[i+1:].strip()
  	else:
  		host = ''
  		tail = url
  	
  	for i in range(len(tail)):
  		if not tail[i].isdigit():
  			break
  	else:
  		i += 1
  	
  	portstr = tail[:i].strip()
  	tail = tail[i:].strip()
  	
  	found = len(tail)
  	for c in ('/', '+', '-', '*'):
  		i = tail.find(c)
  		if (i > -1) and (i < found):
  			found = i
  	
  	head = tail[:found].strip()
  	prefix = tail[found:].strip()
  	
  	prefix = prefix.strip('/')
  	if len(prefix) and prefix[0] not in ('+', '-', '*'):
  		prefix = '/' + prefix
  	
  	if len(head) and not len(host):
  		host = head
  
  	if len(host):
  		try:
  			host = socket.gethostbyname(host)
  		except socket.error:
  			pass
  
  	try:
  		port = int(portstr)
  	except ValueError:
  		port = None
  	
  	return ((host, port), prefix)
function_tokens: def parseUrlStr ( url ) : if not ( type ( url ) in types . StringTypes and len ( url ) ) : return ( None , '' ) i = url . find ( "://" ) if i > - 1 : url = url [ i + 3 : ] i = url . find ( ':' ) if i > - 1 : host = url [ : i ] . strip ( ) tail = url [ i + 1 : ] . strip ( ) else : host = '' tail = url for i in range ( len ( tail ) ) : if not tail [ i ] . isdigit ( ) : break else : i += 1 portstr = tail [ : i ] . strip ( ) tail = tail [ i : ] . strip ( ) found = len ( tail ) for c in ( '/' , '+' , '-' , '*' ) : i = tail . find ( c ) if ( i > - 1 ) and ( i < found ) : found = i head = tail [ : found ] . strip ( ) prefix = tail [ found : ] . strip ( ) prefix = prefix . strip ( '/' ) if len ( prefix ) and prefix [ 0 ] not in ( '+' , '-' , '*' ) : prefix = '/' + prefix if len ( head ) and not len ( host ) : host = head if len ( host ) : try : host = socket . gethostbyname ( host ) except socket . error : pass try : port = int ( portstr ) except ValueError : port = None return ( ( host , port ) , prefix )