def METHOD_NAME(scheduler_commands, desired, filter_by_partition=None):
    if filter_by_partition:
        assert_that(len(scheduler_commands.get_compute_nodes(filter_by_partition))).is_equal_to(desired)
    else:
        assert_that(len(scheduler_commands.get_compute_nodes())).is_equal_to(desired)