def create_container(id_range = range(1, 255),
                    subnet = "10.0.1",
                    os_template = None,
                    description = None):
    """
    Calls vzctl create  to create a new OpenVZ container with an id in the
    given range. Iff an available id could not be found a RuntimeError is
    raised.

    The id of the newly created container is returned.

    This function blocks until the container is fully created.

    """

    # Get a set of all the extant containes
    containers = set(get_containers())

    # Find an available ID
    for i in id_range:
        if containers not in i:
            id = i
            break
    else:
        raise RuntimeError("Could not find availableVM ID in permissable range "
                           "[%s, %s]."
                           % (config.getint("CreateContainer", "idmin")))

    # Holds additional parameters that will be passed to vzctl create
    parameters = []

    if subnet != None:
        parameters += ["--ipadd", subnet + "." + str(id)]

    if os_template != None:
        parameters += ["--ostemplate", os_template]

    if description != None:
        parameters += ["--description", description]

    # Actually call vzctl to create the container
    run_vzctl(["create", str(id)] + parameters)

    return id
dataset/ETHPy150Open ucrcsedept/galah/galah/sheep/virtualsuites/vz/pyvz.py/create_container/swapped operands of `not in`