def get_vnc_port(session):
    min_port = CONF.vmware.vnc_port
    port_total = CONF.vmware.vnc_port_total
    allocated_ports = _get_allocated_vnc_ports(session)
    max_port = min_port + port_total
    for port in range(min_port, max_port):
        if port not in allocated_ports:
            return port
    raise exception.ConsolePortRangeExhausted(min_port=min_port,
                                              max_port=max_port)
Test the _write_page_margins() method with top margin
dataset/ETHPy150Open openstack/nova/nova/virt/vmwareapi/vm_util.py/get_vnc_port--crossover with--dataset/ETHPy150Open jmcnamara/XlsxWriter/xlsxwriter/test/worksheet/test_write_page_margins.py/TestWritePageMargins.test_write_page_margins_top