def parse_host(host):
if re.match(r'<STR_LIT>', host) is not None:<EOL><INDENT>return ("<STR_LIT>", int(host))<EOL><DEDENT>if re.match(r'<STR_LIT>', host) is None:<EOL><INDENT>host = "<STR_LIT>" + host<EOL><DEDENT>o = parse.urlparse(host)<EOL>hostname = o.hostname or "<STR_LIT>"<EOL>port = o.port or <NUM_LIT:0><EOL>return (hostname, port)<EOL>
Parses host name and port number from a string.