def reaction_string(stoichiometry, use_metabolite_names=True):
    """Generate the reaction string """

    attrib = "id"
    if use_metabolite_names:
        attrib = "name"

    educts = [(str(abs(value)), getattr(key, attrib)) for key, value in iteritems(stoichiometry) if value < 0.]
    products = [(str(abs(value)), getattr(key, attrib)) for key, value in iteritems(stoichiometry) if value > 0.]

    return " + ".join([" ".join(x) for x in educts])+" --> "+" + ".join([" ".join(x) for x in products])