def charge_balance(model):
compound_charge = {}<EOL>for compound in model.compounds:<EOL><INDENT>if compound.charge is not None:<EOL><INDENT>compound_charge[compound.id] = compound.charge<EOL><DEDENT><DEDENT>for reaction in model.reactions:<EOL><INDENT>charge = reaction_charge(reaction.equation, compound_charge)<EOL>yield reaction, charge<EOL><DEDENT>
Calculate the overall charge for all reactions in the model.

    Yield (reaction, charge) pairs.

    Args:
        model: :class:`psamm.datasource.native.NativeModel`.