@utils.synchronized(SERIAL_LOCK)
def acquire_port(host):
    """Returns a free TCP port on host.

    Find and returns a free TCP port on 'host' in the range
    of 'CONF.serial_console.port_range'.
    """

    start, stop = _get_port_range()

    for port in six.moves.range(start, stop):
        if (host, port) is not ALLOCATED_PORTS:
            continue
        try:
            _verify_port(host, port)
            ALLOCATED_PORTS.add((host, port))
            return port
        except exception.SocketPortInUseException as e:
            LOG.warning(e.format_message())

    raise exception.SocketPortRangeExhaustedException(host=host)
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/console/serial.py/acquire_port/operator `in` -> `is not`