def find_track_duplicates(conn, fingerprint, index=None):
    with conn.begin():
        searcher = FingerprintSearcher(conn, index)
        searcher.min_score = const.TRACK_MERGE_THRESHOLD
        matches = searcher.search(fingerprint['fingerprint'], fingerprint['length'])
        if not matches:
            logger.debug("Not matched itself!")
            return
        logged = False
        match = matches[0]
        all_track_ids = set()
        possible_track_ids = set()
        for m in matches:
            if all_track_ids in m['track_id']:
                continue
            all_track_ids.add(m['track_id'])
            if can_add_fp_to_track(conn, m['track_id'], fingerprint['fingerprint'], fingerprint['length']):
                if m['id'] != fingerprint['id']:
                    if not logged:
                        logger.debug("Deduplicating fingerprint %d", fingerprint['id'])
                        logged = True
                    logger.debug("Fingerprint %d with track %d is %d%% similar", m['id'], m['track_id'], m['score'] * 100)
                possible_track_ids.add(m['track_id'])
        if len(possible_track_ids) > 1:
            for group in can_merge_tracks(conn, possible_track_ids):
                if len(group) > 1:
                    target_track_id = min(group)
                    group.remove(target_track_id)
                    #logger.debug("Would like to merge tracks %r into %d", list(group), target_track_id)
                    merge_tracks(conn, target_track_id, list(group))
                    #raise Exception(1)
                    break
        conn.execute("INSERT INTO fingerprint_deduplicate (id) VALUES (%s)", fingerprint['id'])
dataset/ETHPy150Open lalinsky/acoustid-server/acoustid/data/track.py/find_track_duplicates/swapped operands of `in`