def aascore(aa1, aa2, match=1, penaltyA=-10000, penaltyX=0, gap_penalty=-1):
    """Returns matching score for the pair of AAs."""
    aa1 = aa1.upper()
    aa2 = aa2.upper()
    if not aa1.isalpha() or not aa2.isalpha():
        return gap_penalty
    if aa1 == aa2:
        return 1
    elif aa1=='X' or aa2=='X':
        return penaltyX
    else:
        return penaltyA