def get_scenfit_labelings(instance,nm, OS, FP, FC, EP):
  '''
  returns a list of atmost [nm] ``TermSet`` representing scenfit labelings
  to the system described by the ``TermSet`` object [instance].
  '''
  sem = [sign_cons_prg, bwd_prop_prg]
  if OS : sem.append(one_state_prg)
  if FP : sem.append(fwd_prop_prg)
  if FC : sem.append(founded_prg)
  if EP : sem.append(elem_path_prg)

  inst     = instance.to_file()
  prg      = sem + scenfit + [inst]
  coptions = '--opt-strategy=5'
  solver   = GringoClasp(clasp_options=coptions)
  solution = solver.run(prg,collapseTerms=True,collapseAtoms=False)

  opt      = solution[0].score[0]

  prg      = prg + [show_labels_prg, show_err_prg]
  coptions = str(nm)+' --project --opt-strategy=5 --opt-mode=optN --opt-bound='+str(opt)
  solver2  = GringoClasp(clasp_options=coptions)
  models   = solver2.run(prg,collapseTerms=True,collapseAtoms=False)

  os.unlink(inst)
  return models