'Gets a possibly-remapped outside port
flow is the match of the connection
returns port (maybe from flow, maybe not)'

def _pick_port(self, flow):

    port = flow.tp_src
    if (port < 1024):
        port = random.randint(49152, 65534)
    cycle = 0
    while (cycle < 2):
        if ((flow.nw_proto, port) not in self._used_ports):
            self._used_ports.add((flow.nw_proto, port))
            return port
        port += 1
        if (port >= 65534):
            port = 49152
            cycle += 1
    log.warn('No    ports    to    give!')
    return None
