re.sub(r'^$\n', '', s, flags=re.MULTILINE) 

Read more of this post