def make_legend(ax, handles, labels, ncol, loc, size=20, squeeze=False):
    """
    Plots and returns a legend on the Axes 'ax'. 'handles' contains the swatches
    for the legend, and 'labels' contains the text to associate with each
    handle. (labels[i] corresponds to the text for handles[i].) 'ncol' refers to
    the number of columns for the legend. 'loc' refers to the location of the
    legend. 'size' refers to the font size for the legend, and handles are
    scaled accordingly. If 'squeeze' is True, the margins between the handles/
    text and the border of the legend are made smaller.
    """
    return ax.legend(handles, labels, facecolor='white',  ncol=ncol, loc=loc,
        columnspacing=1, prop={'size': size},
        borderaxespad=.1 if squeeze else .3, borderpad=.3 if squeeze else .5,
        handletextpad=.5)