def split_domain_port(host):
 host = host.lower()
 if (not host_validation_re.match(host)):
  return (u'', u'')
 if (host[(-1)] == u']'):
  return (host, u'')
 bits = host.rsplit(u':', 1)
 if (len(bits) == 2):
  return tuple(bits)
 return (bits[0], u'')

def split_domain_port ( host ) : host = host . lower ( ) if ( not host_validation_re . match ( host ) ) : return ( u'' , u'' ) if ( host [ ( - 1 ) ] == u']' ) : return ( host , u'' ) bits = host . rsplit ( u':' , 1 ) if ( len ( bits ) == 2 ) : return tuple ( bits ) return ( bits [ 0 ] , u'' )
return a tuple from a given host .