Project: s41467-024-51864-y | Function: hits_overlap (python)

system: You are an expert Python programmer implementing algorithms from scientific papers.
Complete the masked function based on the algorithm description.
Follow Python best practices and maintain consistent code style.
Return **only** the complete Python function code.

user: Complete this Python function:

**DESCRIPTION:** Determines if two BLAST hits overlap beyond an allowed threshold on the same contig. Implements genomic coordinate comparison to identify redundant alignments in virulence factor detection.

**KEY TERMS:** {
  "contig_start": "genomic start position",
  "contig_end": "genomic end position",
  "allowed_overlap": "overlap tolerance threshold",
  "overlap_size": "nucleotide overlap length"
}

**CONTEXT CODE:**                 "contig_end" + "\t" +\
                "strand" + "\t" +\
                "gene_id_long" + "\t"+\
                "pcid" + "\t"+\
                "qcovs"+ "\t"+\
                "score" + "\t"+\
                "alignment_length" + "\t"+\
                "typep" + "\t"+\
                "sseq_new" + "\t"+\
                "\n")
    for blast_hit in blast_hits:
        f.write(str(blast_hit.gene_id)+"\t"+\
                blast_hit.contig_name + "\t" + \
                str(blast_hit.contig_start)+"\t"+\
                str(blast_hit.contig_end) + "\t" +\
                str(blast_hit.strand) + "\t" +\
                str(blast_hit.gene_id_long) + "\t"+\
                str(blast_hit.pcid) + "\t"+\
                str(blast_hit.qcovs) + "\t"+\
                str(blast_hit.score) + "\t"+\
                str(blast_hit.alignment_length) + "\t"+\
                str(blast_hit.typep) + "\t"+\
                str(blast_hit.sseq_new) + "\t"+\
                "\n")


    f.close()



def cull_redundant_hits(blast_hits):
    """
    Cull out redundant hits
    """
    raise NotImplementedError("Function implementation has been masked")


def overlapping(hit, existing_hits):
    # Only consider hits in the same reading frame.
    existing_hits = [h for h in existing_hits if
                     h.strand == hit.strand and
                     h.contig_name == hit.contig_name]

    for existing_hit in existing_hits:
        if hits_overlap(hit, existing_hit):
            return True

    return False


def hits_overlap(a, b):
    raise NotImplementedError("Function implementation has been masked")


if __name__ == "__main__":
    select_best_blast_hit(sys.argv[1],sys.argv[2])



Complete the function implementation replacing "raise NotImplementedError".