def METHOD_NAME(scheduler_commands, num_static_nodes, num_dynamic_nodes, partition, cancel_job_id=None):
    """Assert cluster is in expected state before test starts; return list of compute nodes."""
    logging.info(
        "Assert initial condition, expect cluster to have {num_nodes} idle nodes".format(
            num_nodes=num_static_nodes + num_dynamic_nodes
        )
    )
    wait_for_num_nodes_in_scheduler(
        scheduler_commands, num_static_nodes + num_dynamic_nodes, filter_by_partition=partition
    )
    nodes_in_scheduler = scheduler_commands.get_compute_nodes(partition)
    static_nodes, dynamic_nodes = get_partition_nodes(nodes_in_scheduler)
    assert_that(len(static_nodes)).is_equal_to(num_static_nodes)
    assert_that(len(dynamic_nodes)).is_equal_to(num_dynamic_nodes)
    assert_compute_node_states(scheduler_commands, nodes_in_scheduler, expected_states=["idle", "mixed", "allocated"])
    if cancel_job_id:
        # Cancel warm up job so no extra scaling behavior should be happening
        scheduler_commands.cancel_job(cancel_job_id)
        retry(wait_fixed=seconds(20), stop_max_delay=minutes(2))(assert_compute_node_states)(
            scheduler_commands, nodes_in_scheduler, expected_states=["idle"]
        )
    return static_nodes, dynamic_nodes