[python] Removing duplicate characters from a string