code: def check_reaction(reactants, products):
      reactant_list = [reactant.split('@')[0].strip(
          'star').strip('gas') for reactant in reactants]
      product_list = [product.split('@')[0].strip(
          'star').strip('gas') for product in products]
      reactant_atoms = [extract_atoms(reactant) for reactant in reactant_list]
      product_atoms = [extract_atoms(product) for product in product_list]
      reactants = add_atoms(reactant_atoms)
      products = add_atoms(product_atoms)
      r_stars = 0
      p_stars = 0
      for i, a in enumerate(reactant_atoms):
          if a == '' or 'star' in reactant_list[i]:
              r_stars += 1
          elif isinstance(a, float):
              r_stars += a
      for a in product_atoms:
          if a == '':
              p_stars += 1
          elif isinstance(a, float):
              p_stars += a
      assert ''.join(sorted(reactants)) == ''.join(sorted(products))