<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_reactions_with_partially_identical_annotations(model):
 """ Return duplicate reactions based on identical annotation. Identify duplicate reactions globally by checking if any two metabolic reactions have the same entries in their annotation attributes. This can be useful to identify one 'type' of reactions that occurs in several compartments, to curate merged models or to clean-up bulk model modifications. The heuristic looks at annotations with the keys "metanetx.reaction", "kegg.reaction", "brenda", "rhea", "biocyc", "bigg.reaction" only. Parameters model : cobra.Model The metabolic model under investigation. Returns ------- dict A mapping from sets of annotations to groups of reactions with those annotations. int The total number of unique reactions that are duplicated. """

    duplicates = {}
    rxn_db_identifiers = ["metanetx.reaction", "kegg.reaction", "brenda",
                          "rhea", "biocyc", "bigg.reaction"]
    # Build a list that associates a reaction with a set of its annotations.
    ann_rxns = []
    for rxn in model.reactions:
        ann = []
        for key in rxn_db_identifiers:
            if key in rxn.annotation:
                if isinstance(rxn.annotation[key], list):
                    ann.extend([(key, elem) for elem in rxn.annotation[key]])
                else:
                    ann.append((key, rxn.annotation[key]))
        ann_rxns.append((rxn, frozenset(ann)))
    # Compute the intersection between annotations and record the matching
    # reaction identifiers.
    for (rxn_a, ann_a), (rxn_b, ann_b) in combinations(ann_rxns, 2):
        mutual_pair = tuple(ann_a & ann_b)
        if len(mutual_pair) > 0:
            duplicates.setdefault(mutual_pair, set()).update(
                [rxn_a.id, rxn_b.id])
    # Transform the object for JSON compatibility
    num_duplicated = set()
    duplicated = {}
    for key in duplicates:
        # Object keys must be strings in JSON.
        new_key = ",".join(sorted("{}:{}".format(ns, term) for ns, term in key))
        duplicated[new_key] = rxns = list(duplicates[key])
        num_duplicated.update(rxns)
    return duplicated, len(num_duplicated)