//  [python]
def cosine_scores(cosine_scores_raw, model_names=None, model_label = 'Model', raw=False, custom_colors = None):

    if model_names == None:

        if raw == False:
            
            cosine_scores_ = pd.DataFrame({" ": [t[0] + r'$\rightarrow$' + t[1] for t in cosine_scores_raw.keys()], "Cosine similarity": cosine_scores_raw.values()})
            
            ax = sns.barplot(
                data=transition_scores_, 
                y=" ", x="Cosine similarity", color='k',
                ci="sd", alpha=.6, orient='h'
            ) #color='k', 
            #ax.set_xticklabels(rotation=90)
            ax.set(xlim=(-1, 1))
        
            return ax

        else:
            
            score = []
            transition = []
            embedding=[]
            
            for key in cosine_scores_raw.keys():
                for item in cosine_scores_raw[key]:
                    score.append(item)
                    transition.append(key[0] + r'$\rightarrow$' + key[1])
            
            transition_scores_ = pd.DataFrame({'Cosine similarity':score, ' ':transition})
            
            
            PROPS = {
            'boxprops':{'facecolor':'darkgrey', 'edgecolor':'black'},
            'medianprops':{'color':'black'},
            'whiskerprops':{'color':'black'},
            'capprops':{'color':'black'}
            }
            
            ax = sns.boxplot(
                data=transition_scores_, 
                y=' ', x="Cosine similarity", 
                orient='h', fliersize=0, **PROPS, showmeans=True,
                            meanprops={"marker":"o",
                       "markerfacecolor":"white", 
                       "markeredgecolor":"black",
                      "markersize":"10"}
            ) #color='k', 
            #ax.set_xticklabels(rotation=90)
            ax.set(xlim=(-1, 1))
            return ax
        
    else:

        if raw == False:
            
            transition_scores_ = [pd.DataFrame({" ": [t[0] + r'$\rightarrow$' + t[1] for t in tscores.keys()], "Cosine similarity": tscores.values()}) for tscores in transition_scores_raw]
            
            for i in range(len(model_names)):
                transition_scores_[i][model_label] = model_names[i]
                
            transition_scores_ = pd.DataFrame(pd.concat(transition_scores_, axis=0))
            
            
            ax = sns.barplot(
                data=transition_scores_, 
                y=" ", x="Cosine similarity", hue=model_label,
                ci="sd", alpha=1, orient='h', palette = 'Set1'
            ) #color='k', 
            #ax.set_xticklabels(rotation=90)
            ax.set(xlim=(-1, 1))
            
            return ax    

        else:

            score = []
            transition = []
            embedding=[]
            
            for items, name in zip(cosine_scores_raw, model_names):
                for key in items.keys():
                    for item in items[key]:
                        score.append(item)
                        transition.append(key[0] + r'$\rightarrow$' + key[1])
                        embedding.append(name)

            transition_scores_ = pd.DataFrame({'Cosine similarity':score, ' ':transition, model_label:embedding})
            
            if np.any(custom_colors != None):
                ax = sns.boxplot(
                    data=transition_scores_, 
                    y=' ', x="Cosine similarity", hue=model_label,
                    orient='h', palette = custom_colors, fliersize=0
                ) #color='k',
            else:
                ax = sns.boxplot(
                    data=transition_scores_, 
                    y=' ', x="Cosine similarity", hue=model_label,
                    orient='h', palette = 'Set1', fliersize=0
                ) #color='k',
            #ax.set_xticklabels(rotation=90)
            ax.set(xlim=(-1, 1))
            
            #ax.fig.suptitle('Model c)')
            return ax