The question
I'd like to have a function in Python for splitting a given string containing pinyin into its syllables. The following two code blocks show how the function is intended to work.
Input
tàngsuǒ
débùchángshī
fēngtǔrénqíng
huǎngrán dà wù
Output
tàng suǒ
fēng tǔ rén qíng
dé bù cháng shī
huǎng rán dà wù
Additional notes
The function should support pinyin of all Chinese characters. I emphasize this because I have noticed that some software that input pinyin can't type the syllables shown in the code block below.
Input
shài
hūlüè
ǹg
ang
hng
Output
shài
hū lüè
ǹg
ang
hng
For the record, I'm considering the pinyin that is taught in the HSK Standard Course book series (i.e. pinyin of Standard Mandarin).