def guess_srv_port(port1, port2, proto='tcp'):
 if (not _PORTS_POPULATED):
  _set_ports()
 ports = _PORTS.get(proto, {})
 cmpval = cmp(ports.get(port1, 0), ports.get(port2, 0))
 if (cmpval == 0):
  return cmp(port2, port1)
 return cmpval

def guess_srv_port ( port1 , port2 , proto = 'tcp' ) : if ( not _PORTS_POPULATED ) : _set_ports ( ) ports = _PORTS . get ( proto , { } ) cmpval = cmp ( ports . get ( port1 , 0 ) , ports . get ( port2 , 0 ) ) if ( cmpval == 0 ) : return cmp ( port2 , port1 ) return cmpval
returns 1 when port1 is probably the server port .