def check_clonotype(
    probe_v_gene: str,
    probe_j_gene: str,
    probe_cdr3_len: int,
    probe_cdr3_aa_seq: str,
    target_v_gene: str,
    target_j_gene: str,
    target_cdr3_len: int,
    target_cdr3_aa_seq: str,
) -> float:

    """
    Compares two VH sequences to check if clonotypes match.
    Returns sequence identity of HCDR3 if clonotype is the same i.e. VH and JH genes are the same.
    If clonotypes do not match, sequence identity == 0.
    """

    sequence_identity = 0

    if (
        probe_v_gene == target_v_gene
        and probe_j_gene == target_j_gene
        and probe_cdr3_len == target_cdr3_len
    ):

        # inverse hamming distance
        match_count = len(
            [
                True
                for res1, res2 in zip(probe_cdr3_aa_seq, target_cdr3_aa_seq)
                if res1 == res2
            ]
        )

        sequence_identity = match_count / probe_cdr3_len

    return sequence_identity