def parse_compound(s, global_compartment=None):
m = re.match(r'<STR_LIT>', s)<EOL>if m:<EOL><INDENT>s = m.group(<NUM_LIT:1>)<EOL><DEDENT>m = re.match(r'<STR_LIT>', s)<EOL>if m:<EOL><INDENT>compound_id = m.group(<NUM_LIT:1>)<EOL>compartment = m.group(<NUM_LIT:2>)<EOL><DEDENT>else:<EOL><INDENT>compound_id = s<EOL>compartment = global_compartment<EOL><DEDENT>return Compound(compound_id, compartment=compartment)<EOL>
Parse a compound specification.

    If no compartment is specified in the string, the global compartment
    will be used.