<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_duplicate_reactions(model):
 """ Return a list with pairs of reactions that are functionally identical. Identify duplicate reactions globally by checking if any two reactions have the same metabolites, same directionality and are in the same compartment. This can be useful to curate merged models or to clean-up bulk model modifications. The heuristic compares reactions in a pairwise manner. For each reaction, the metabolite annotations are checked for a description of the structure (via InChI and InChIKey).If they exist, substrates and products as well as the stoichiometries of any reaction pair are compared. Only reactions where the substrates, products, stoichiometry and reversibility are identical are considered to be duplicates. This test will not be able to identify duplicate reactions if there are no structure annotations. Further, it will report reactions with differing bounds as equal if they otherwise match the above conditions. Parameters model : cobra.Model The metabolic model under investigation. Returns ------- list A list of pairs of duplicate reactions based on metabolites. int The number of unique reactions that have a duplicates """

    met2mol = map_metabolites_to_structures(model.metabolites,
                                            model.compartments)
    # Build a list associating reactions with their stoichiometry in molecular
    # structure space.
    structural = []
    for rxn in model.reactions:
        # Ignore reactions that have metabolites without structures.
        if not all(met in met2mol for met in rxn.metabolites):
            continue
        # We consider substrates and products separately since, for example,
        # the InChI for H2O and OH is the same.
        substrates = {
            met2mol[met]: rxn.get_coefficient(met) for met in rxn.reactants
        }
        products = {
            met2mol[met]: rxn.get_coefficient(met) for met in rxn.products
        }
        structural.append((rxn, substrates, products))
    # Compare reactions using their structure-based stoichiometries.
    num_duplicated = set()
    duplicates = []
    for (rxn_a, sub_a, prod_a), (rxn_b, sub_b, prod_b) in combinations(
            structural, 2):
        # Compare the substrates.
        if sub_a != sub_b:
            continue
        # Compare the products.
        if prod_a != prod_b:
            continue
        # Compare whether they are both (ir-)reversible.
        if rxn_a.reversibility != rxn_b.reversibility:
            continue
        # TODO (Moritz Beber): We could compare bounds here but it might be
        #  worth knowing about the reactions even if their bounds differ?
        duplicates.append((rxn_a.id, rxn_b.id))
        num_duplicated.add(rxn_a.id)
        num_duplicated.add(rxn_b.id)
    return duplicates, len(num_duplicated)