code: def finished(cls, jobid):
          
          output = subprocess.check_output(
              [SACCT, '-n', '-X', '-o', "end", '-j', str(jobid)]
          )
          end = output.strip().decode()
          return end not in {'Unknown', ''}
docs: Check whether a SLURM job is finished or not