Returns count of all mapped alignments in input BAM (based on index)

def total_align_count(bam_filepath):
    '''Returns count of all mapped alignments in input BAM (based on index)'''
    count = 0
    for line in idxstats(bam_filepath):
        if line:
            chrom, _, mapped, unmapped = line.strip().split('\t')
            if chrom != '*':
                count += int(mapped) + int(unmapped)
    return count