<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def retrieve_scores(gname, sdir, codon_pos, germ_aa, somatic_aa, default_mga=5., default_vest=0, no_file_flag=-1):
 """Retrieves scores from pickle files. Used by summary script. """

    # get variant types
    #var_class = cutils.get_variant_classification(germ_aa, somatic_aa, codon_pos)

    # get information about MGA entropy
    mga_path = os.path.join(sdir, gname+".mgaentropy.pickle")
    if os.path.exists(mga_path):
        if sys.version_info < (3,):
            # python 2.7 way
            with open(mga_path) as handle:
                mga_ent = pickle.load(handle)
        else:
            # python 3.X way
            with open(mga_path, 'rb') as handle:
                mga_ent = pickle.load(handle, encoding='latin-1')
    else:
        mga_ent = None
    missense_pos = [p for i, p in enumerate(codon_pos)
                    if (germ_aa[i]!=somatic_aa[i]) and
                       (germ_aa[i] not in ['-', '*', 'Splice_Site']) and
                       (somatic_aa[i] not in ['-', '*', 'Splice_Site'])]
    total_mga_ent = compute_mga_entropy_stat(mga_ent, missense_pos, sum, default_mga)

        #mga_ent_ixs = [codon_pos[i] for i in range(len(var_class))
                       #if var_class[i] == 'Missense_Mutation']
        #len_mga_ent = len(mga_ent)
        #mga_ent_scores = [mga_ent[ix] for ix in mga_ent_ixs if ix < len_mga_ent]
        #if mga_ent_scores:
            #total_mga_ent = sum(mga_ent_scores)
        #else:
            #total_mga_ent = default_mga
    #else:
        #total_mga_ent = no_file_flag

    # get information about VEST scores
    vest_path = os.path.join(sdir, gname+".vest.pickle")
    if os.path.exists(vest_path):
        if sys.version_info < (3,):
            # python 2.7 way
            with open(vest_path) as handle:
                vest_score = pickle.load(handle)
        else:
            # python 3.X way
            with open(vest_path, 'rb') as handle:
                vest_score = pickle.load(handle, encoding='latin-1')
    else:
        vest_score = None
    total_vest = compute_vest_stat(vest_score,
                                   germ_aa, somatic_aa, codon_pos,
                                   stat_func=sum, default_val=default_vest)
        #vest_scores = [vest_score.get(codon_pos[i]+1, {}).get(germ_aa[i], {}).get(somatic_aa[i], default_vest)
                        #for i in range(len(var_class))
                        #if var_class[i] == 'Missense_Mutation']
        #total_vest = sum(vest_scores)
    #else:
        #total_vest = no_file_flag
    return total_mga_ent, total_vest