<human>:  How do I coalesce a sequence of identical characters into just one?
<bot>: Here is some code to coalesce non-word-characters in string `a`

print(re.sub('(\\W)\\1+', '\\1', a))

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.