<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_sbml_reaction(entry, new_id, compartment_map, compound_map):
 """Translate SBML reaction entry."""

    new_entry = DictReactionEntry(entry, id=new_id)

    # Convert compound IDs in reaction equation
    if new_entry.equation is not None:
        compounds = []
        for compound, value in new_entry.equation.compounds:
            # Translate compartment to new ID, if available.
            compartment = compartment_map.get(
                compound.compartment, compound.compartment)
            new_compound = compound.translate(
                lambda name: compound_map.get(name, name)).in_compartment(
                    compartment)
            compounds.append((new_compound, value))

        new_entry.equation = Reaction(
            new_entry.equation.direction, compounds)

    # Get XHTML notes properties
    for key, value in iteritems(parse_xhtml_reaction_notes(entry)):
        if key not in new_entry.properties:
            new_entry.properties[key] = value

    return new_entry