def _reaction_to_dicts(reaction):
def dict_from_iter_sum(it):<EOL><INDENT>d = {}<EOL>for k, v in it:<EOL><INDENT>if k not in d:<EOL><INDENT>d[k] = <NUM_LIT:0><EOL><DEDENT>d[k] += v<EOL><DEDENT>return d<EOL><DEDENT>left = dict_from_iter_sum(reaction.left)<EOL>right = dict_from_iter_sum(reaction.right)<EOL>return left, right<EOL>
Convert a reaction to reduced left, right dictionaries.