def string2port(port_str):
 return struct.unpack('>H', port_str)[0]

def string2port ( port_str ) : return struct . unpack ( '>H' , port_str ) [ 0 ]
this function converts between a packed port number to an integer .