This script removes all duplicated lines:

#drscript
#unique.py
text = DrDocument.GetText()
eol = DrDocument.GetEndOfLineCharacter()
text = text.split(eol)
#oneliner from German Python Forum (remove from list doubled entries)
text = eol.join([text[i] for i in xrange(len(text)) if text[i] not in text[:i]])
DrDocument.SetText(text)