def parse_cigar_for_indel(cigar):
    """
    Parse CIGAR string and return pysam-suitable tuples.

    MIDNSHP => 0123456

    >>> parse_cigar("4S17M8D4M9I3H")
    [(4, 4), (0, 17), (2, 8), (0, 4), (1, 9), (5, 3)]
    """
    # maps operations to their integer encodings
    ops = dict( (i,j) for (j, i) in enumerate('MIDNSHP') )
    result = []
    n = ''
    
    for c in cigar:
        if c.isdigit():
            n += c
        elif c in ops:
            result.append( [ops[c], int(n)] )
            n = ''
    return result