<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def translate_reaction(reaction, metabolite_mapping):
 """ Return a mapping from KEGG compound identifiers to coefficients. Parameters reaction : cobra.Reaction The reaction whose metabolites are to be translated. metabolite_mapping : dict An existing mapping from cobra.Metabolite to KEGG compound identifier that may already contain the metabolites in question or will have to be extended. Returns ------- dict The stoichiometry of the reaction given as a mapping from metabolite KEGG identifier to coefficient. """

    # Transport reactions where the same metabolite occurs in different
    # compartments should have been filtered out but just to be sure, we add
    # coefficients in the mapping.
    stoichiometry = defaultdict(float)
    for met, coef in iteritems(reaction.metabolites):
        kegg_id = metabolite_mapping.setdefault(met, map_metabolite2kegg(met))
        if kegg_id is None:
            continue
        stoichiometry[kegg_id] += coef
    return dict(stoichiometry)