diff --git a/LCS/PyCommon/cep4_utils.py b/LCS/PyCommon/cep4_utils.py
index 0dec675b9872b023680057f4b310aa187a236c7f..c2e800da1b3117825a59af11d68612382b40efe9 100755
--- a/LCS/PyCommon/cep4_utils.py
+++ b/LCS/PyCommon/cep4_utils.py
@@ -123,23 +123,22 @@ def get_cep4_slurm_nodes(states, partition: str) -> []:
 
     try:
         # filter out unknown states
-        _states = [s for s in states if s in SLURM_STATES]
-        if not _states:
+        if any(s for s in states if s not in SLURM_STATES):
             raise ValueError("the given states:%s are not valid slurm states:%s" % (states, SLURM_STATES))
 
         if partition not in SLURM_PARTITIONS:
             raise ValueError("the given partition:%s is not one of the valid cep4 slurm partition:%s" % (partition, SLURM_PARTITIONS))
 
-        logger.debug('determining available cep4 nodes states:%s, partition:%s', _states, partition)
+        logger.debug('determining available cep4 nodes states:%s, partition:%s', states, partition)
 
         # find out which nodes are available
-        cmd = ['sinfo -p %s -t %s' % (partition, ','.join(_states))]
+        cmd = ['sinfo -p %s -t %s' % (partition, ','.join(states))]
         cmd = wrap_command_in_cep4_head_node_ssh_call(cmd)
 
         logger.debug('executing command: %s', ' '.join(cmd))
         out = check_output_returning_strings(cmd)
         lines = out.split('\n')
-        for state in _states:
+        for state in states:
             try:
                 line = next(l for l in lines if state in l).strip()
                 # get nodes string part of line: