def print_plot(fund, benchmark, graph_name, filename, s_original_name="", lf_dividend_rets=0.0, leverage=False, i_start_cash = 1000000, s_leverage_name="Leverage"):
    pyplot.clf()
    fig = pyplot.figure()
    from matplotlib.font_manager import FontProperties
    fontP = FontProperties()
    fontP.set_size('small')

    if type(leverage)==type(False):
        ax = pyplot.subplot(111)
    else:
        gs = gridspec.GridSpec(2, 1, height_ratios=[4, 1])
        ax = pyplot.subplot(gs[0])

    start_date = 0
    end_date = 0
    if(type(fund)!= type(list())):
        if(start_date == 0 or start_date>fund.index[0]):
            start_date = fund.index[0]
        if(end_date == 0 or end_date<fund.index[-1]):
            end_date = fund.index[-1]
        mult = i_start_cash/fund.values[0]
        pyplot.plot(fund.index, fund.values * mult,'b', label = \
                                 path.basename(graph_name))
    else:
        i=0
        for entity in fund:
            if i == 1 and len(fund)!=1:
                for j in range(len(entity)):
                    if(start_date == 0 or start_date>entity[j].index[0]):
                        start_date = entity[j].index[0]
                    if(end_date == 0 or end_date<entity[j].index[-1]):
                        end_date = entity[j].index[-1]
                    mult = i_start_cash/entity[j].values[0]
                    if j ==0:
                        pyplot.plot(entity[j].index, entity[j].values * mult, 'k', label = \
                                      s_original_name[j])
                    else:
                        pyplot.plot(entity[j].index, entity[j].values * mult, 'g', label = \
                                      s_original_name[j])
            else:
                if(start_date == 0 or start_date>entity.index[0]):
                    start_date = entity.index[0]
                if(end_date == 0 or end_date<entity.index[-1]):
                    end_date = entity.index[-1]
                mult = i_start_cash/entity.values[0]
                pyplot.plot(entity.index, entity.values * mult, 'b', label = \
                                  path.basename(graph_name))
            i=i+1
    timeofday = dt.timedelta(hours = 16)
    timestamps = du.getNYSEdays(start_date, end_date, timeofday)
    dataobj = de.DataAccess('mysql')
    benchmark_close = dataobj.get_data(timestamps, benchmark, ["close"])
    benchmark_close = benchmark_close[0]
    benchmark_close = benchmark_close.fillna(method='pad')
    benchmark_close = benchmark_close.fillna(method='bfill')
    benchmark_close = benchmark_close.fillna(1.0)

    if type(lf_dividend_rets) != type(0.0):
        for i,sym in enumerate(benchmark):
            benchmark_close[sym] = _dividend_rets_funds(benchmark_close[sym], lf_dividend_rets[i])

    for i,sym in enumerate(benchmark):
        mult = i_start_cash / benchmark_close[sym].values[0]
        pyplot.plot(benchmark_close[sym].index, \
                benchmark_close[sym].values*mult, 'r', label = sym)

    # pyplot.gcf().autofmt_xdate()
    # pyplot.gca().fmt_xdata = mdates.DateFormatter('%m-%d-%Y')
    # pyplot.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b %d %Y'))
    pyplot.xlabel('Date', size='xx-small')
    pyplot.ylabel('Fund Value', size='xx-small')
    pyplot.xticks(size='xx-small')
    pyplot.yticks(size='xx-small')

    # Shink current axis's height by 10% on the bottom
    box = ax.get_position()
    ax.set_position([box.x0, box.y0 + box.height * 0.1,
                     box.width, box.height * 0.9])

    # Put a legend below current axis
    ax.legend(prop=fontP, loc='upper center', bbox_to_anchor=(0.5, -0.05),
               ncol=3)


    if type(leverage)!=type(False):
        ax1 = pyplot.subplot(gs[1])
        if type(leverage) == type([]):
            for i in range(len(leverage)):
                pyplot.plot(leverage[i].index, leverage[i].values, label=s_leverage_name[i])
        else:
            pyplot.plot(leverage.index, leverage.values, label=s_leverage_name)
        # pyplot.gcf().autofmt_xdate()
        # pyplot.gca().fmt_xdata = mdates.DateFormatter('%m-%d-%Y')
        # pyplot.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b %d %Y'))
        if type(leverage) != type([]):
            labels=[]
            max_label=max(leverage.values)
            min_label=min(leverage.values)
            rounder= -1*(round(log10(max_label))-1)
            labels.append(round(min_label*0.9, int(rounder)))
            labels.append(round((max_label+min_label)/2, int(rounder)))
            labels.append(round(max_label*1.1, int(rounder)))
            pyplot.yticks(labels, size='xx-small')
        # pyplot.title(graph_name + " Leverage")
        pyplot.xlabel('Date', size='xx-small')
        pyplot.ylabel('Exposure', size='xx-small')
        pyplot.xticks(size='xx-small')
        pyplot.yticks(size='xx-small')

        # Shink current axis's height by 10% on the bottom
        box = ax1.get_position()
        ax1.set_position([box.x0, box.y0 + box.height * 0.1,
                         box.width, box.height * 0.9])

        # Put a legend below current axis
        ax1.legend(prop=fontP, loc='upper center', bbox_to_anchor=(0.5, -0.15),
                   ncol=3)

    pyplot.savefig(filename, format = 'png')
When monitored serverset is changed multiple times, the callback
dataset/ETHPy150Open tucker777/QSTK/Bin/report.py/print_plot--crossover with--dataset/ETHPy150Open pinterest/kingpin/kingpin/tests/kazoo_utils/test_file_watch.py/FileWatchTestCase.test_multiple_serverset_changes