def numbered_syllable_to_accented(s):
if s == '<STR_LIT>':<EOL><INDENT>return '<STR_LIT:r>'  <EOL><DEDENT>lowercase_syllable, case_memory = _lower_case(s)<EOL>syllable, tone = _parse_numbered_syllable(lowercase_syllable)<EOL>syllable = syllable.replace('<STR_LIT:v>', '<STR_LIT>')<EOL>if re.search('<STR_LIT>' % _UNACCENTED_VOWELS, syllable) is None:<EOL><INDENT>return s<EOL><DEDENT>if '<STR_LIT:a>' in syllable:<EOL><INDENT>accented_a = _numbered_vowel_to_accented('<STR_LIT:a>', tone)<EOL>accented_syllable = syllable.replace('<STR_LIT:a>', accented_a)<EOL><DEDENT>elif '<STR_LIT:e>' in syllable:<EOL><INDENT>accented_e = _numbered_vowel_to_accented('<STR_LIT:e>', tone)<EOL>accented_syllable = syllable.replace('<STR_LIT:e>', accented_e)<EOL><DEDENT>elif '<STR_LIT:o>' in syllable:<EOL><INDENT>accented_o = _numbered_vowel_to_accented('<STR_LIT:o>', tone)<EOL>accented_syllable = syllable.replace('<STR_LIT:o>', accented_o)<EOL><DEDENT>else:<EOL><INDENT>vowel = syllable[max(map(syllable.rfind, _UNACCENTED_VOWELS))]<EOL>accented_vowel = _numbered_vowel_to_accented(vowel, tone)<EOL>accented_syllable = syllable.replace(vowel, accented_vowel)<EOL><DEDENT>return _restore_case(accented_syllable, case_memory)<EOL>
Convert numbered Pinyin syllable *s* to an accented Pinyin syllable.

    It implements the following algorithm to determine where to place tone
    marks:

    1. If the syllable has an 'a', 'e', or 'o' (in that order), put the
        tone mark over that vowel.
    2. Otherwise, put the tone mark on the last vowel.