def _match_cigar(qseq, hseq, query_start, query_end, query_len):
    """Return CIGAR string for the match with the given paraemters."""
    match_cigar = []
    if query_start > 0:
        match_cigar.append([query_start + 1, 'H'])
    for i, (q, h) in enumerate(zip(qseq, hseq)):
        if q == '-':
            op = 'D'
        elif h == '-':
            op = 'I'
        else:
            op = 'M'
        if match_cigar[-1][1] == op:
            match_cigar[-1][0] += 1
        else:
            match_cigar.append([1, op])
    if query_end != query_len:
        match_cigar.append([query_len - query_end, 'H'])
    return match_cigar
