def aln_resnums_inserts(record, aln, offset):
    """Return two lists: residue numbers for model columns; inserts."""
    aln_resnums = []
    aln_inserts = []
    in_insert = False
    del_len = 0
    curr_ins_start = None
    for i, c in enumerate(aln):
        if c.islower():
            if not in_insert:
                # Start of a new insert region
                curr_ins_start = offset + i + 1 - del_len
                in_insert = True
            continue

        if in_insert:
            # End of the current insert region
            aln_inserts.append((curr_ins_start, offset + i - del_len))
            in_insert = False

        if c.isupper():
            # Match position
            aln_resnums.append((c, offset + i - del_len + 1))
        elif c == '-':
            # Deletion position
            aln_resnums.append(('-', None))
            del_len += 1
        else:
            raise ValueError("Unexpected character '%s'" % c)
    return aln_resnums, aln_inserts