def to_pinyin(s, accented=True):
identity = identify(s)<EOL>if identity == PINYIN:<EOL><INDENT>if _has_accented_vowels(s):<EOL><INDENT>return s if accented else accented_to_numbered(s)<EOL><DEDENT>else:<EOL><INDENT>return numbered_to_accented(s) if accented else s<EOL><DEDENT><DEDENT>elif identity == ZHUYIN:<EOL><INDENT>return zhuyin_to_pinyin(s, accented=accented)<EOL><DEDENT>elif identity == IPA:<EOL><INDENT>return ipa_to_pinyin(s, accented=accented)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>
Convert *s* to Pinyin.

    If *accented* is ``True``, diacritics are added to the Pinyin syllables. If
    it's ``False``, numbers are used to indicate tone.