def _bind_sockets(address, port):
 ss = netutil.bind_sockets(port=(port or 0), address=address)
 assert len(ss)
 ports = {s.getsockname()[1] for s in ss}
 assert (len(ports) == 1), 'Multiple ports assigned??'
 actual_port = ports.pop()
 if port:
  assert (actual_port == port)
 return (ss, actual_port)

def _bind_sockets ( address , port ) : ss = netutil . bind_sockets ( port = ( port or 0 ) , address = address ) assert len ( ss ) ports = { s . getsockname ( ) [ 1 ] for s in ss } assert ( len ( ports ) == 1 ) , 'Multiple ports assigned??' actual_port = ports . pop ( ) if port : assert ( actual_port == port ) return ( ss , actual_port )
like tornado .