modified detect_duplicate_entry.py