Checked using and some manual proofreading: def check_entry(po_file, entry): if entry.msgid.endswith(' ::'): return if entry.msgid.endswith('::'): if entry.msgstr.endswith(': ::'): return entry.msgstr = entry.msgstr.rstrip(' :. ') + ' ::'