def build_scoring_matrix(alphabet, diag_score, off_diag_score, dash_score):
    """
  Takes as input a set of characters alphabet 
  and three scores diag_score, off_diag_score,
  and dash_score. The function returns a dictionary
  of dictionaries whose entries are indexed by pairs 
  of characters in alphabet plus '-'. The score for 
  any entry indexed by one or more dashes is dash_score.
  The score for the remaining diagonal entries is diag_score. 
  Finally, the score for the remaining off-diagonal entries is off_diag_score
    """
    alphabet.add('-')
    scoring_matri = {}
    for first_ltr in alphabet:
        temp = {}
        for sec_ltr in alphabet:
            if first_ltr == sec_ltr and first_ltr != '-':
                temp[sec_ltr] = diag_score
            elif first_ltr == '-' or sec_ltr == '-':
                temp[sec_ltr] = dash_score
            else:
                temp[sec_ltr] = off_diag_score
        scoring_matri[first_ltr] = temp
    return scoring_matri