import re
text = """"This is a quote"
This is an end "partial-
quote" Here is more text.
This is an end "partial-
quote w/o more text
This is an "embedded" quote
"This is a quote"
This is an end "partial-
quote" Here is more text.
This is an end "partial-
quote w/o more text"
This is an "embedded" quote"""
print re .sub ( r""""[^"\n ]+?\n [^"\n ]+?(?:"|$)\s *""" , "\n " , text, flags= re .M )
aW1wb3J0IHJlCgp0ZXh0ID0gIiIiIlRoaXMgaXMgYSBxdW90ZSIKVGhpcyBpcyBhbiBlbmQgInBhcnRpYWwtCnF1b3RlIiBIZXJlIGlzIG1vcmUgdGV4dC4KVGhpcyBpcyBhbiBlbmQgInBhcnRpYWwtCnF1b3RlIHcvbyBtb3JlIHRleHQKVGhpcyBpcyBhbiAiZW1iZWRkZWQiIHF1b3RlCgoiVGhpcyBpcyBhIHF1b3RlIgpUaGlzIGlzIGFuIGVuZCAicGFydGlhbC0KcXVvdGUiIEhlcmUgaXMgbW9yZSB0ZXh0LgpUaGlzIGlzIGFuIGVuZCAicGFydGlhbC0KcXVvdGUgdy9vIG1vcmUgdGV4dCIKVGhpcyBpcyBhbiAiZW1iZWRkZWQiIHF1b3RlIiIiCgpwcmludCByZS5zdWIociIiIiJbXiJcbl0rP1xuW14iXG5dKz8oPzoifCQpXHMqIiIiLCAiXG4iLCB0ZXh0LCBmbGFncz1yZS5NKQ==