def _reaction_representer(dumper, data):
if len(data.compounds) > _MAX_REACTION_LENGTH:<EOL><INDENT>def dict_make(compounds):<EOL><INDENT>for compound, value in compounds:<EOL><INDENT>yield OrderedDict([<EOL>('<STR_LIT:id>', text_type(compound.name)),<EOL>('<STR_LIT>', compound.compartment),<EOL>('<STR_LIT:value>', value)])<EOL><DEDENT><DEDENT>left = list(dict_make(data.left))<EOL>right = list(dict_make(data.right))<EOL>direction = data.direction == Direction.Both<EOL>reaction = OrderedDict()<EOL>reaction['<STR_LIT>'] = direction<EOL>if data.direction == Direction.Reverse:<EOL><INDENT>reaction['<STR_LIT:left>'] = right<EOL>reaction['<STR_LIT:right>'] = left<EOL><DEDENT>else:<EOL><INDENT>reaction['<STR_LIT:left>'] = left<EOL>reaction['<STR_LIT:right>'] = right<EOL><DEDENT>return dumper.represent_data(reaction)<EOL><DEDENT>else:<EOL><INDENT>return _represent_text_type(dumper, text_type(data))<EOL><DEDENT>
Generate a parsable reaction representation to the YAML parser.

    Check the number of compounds in the reaction, if it is larger than 10,
    then transform the reaction data into a list of directories with all
    attributes in the reaction; otherwise, just return the text_type format
    of the reaction data.