code: def find_unique_metabolites(model):
      
      unique = set()
      for met in model.metabolites:
          is_missing = True
          for comp in model.compartments:
              if met.id.endswith("_{}".format(comp)):
                  unique.add(met.id[:-(len(comp) + 1)])
                  is_missing = False
                  break
          if is_missing:
              unique.add(met.id)
      return unique
docs: Return set of metabolite IDs without duplicates from compartments.