def print_results(raw_information, configuration, date, cfg, verbose = True):
    working_methods = METHODS[:]

    all_data = {
        # method : {
        #      protocol : {
        #          max:  (x,y),
        #          min:  (x,y),
        #          mean: (x,y)
        #      },
        # }
    }

    LINES = ('std','max','min','avg')

    protocols = set()

    for method in METHODS:
        method_data = {}
        all_data[method] = method_data

        for line in LINES:
            def func_on_results(results):
                return getattr(results, line + '_call_times')[method]

            data = {}
            data['protocols'] = raw_information.keys()
            for protocol in data['protocols']:
                try:
                    x, y = raw_information[protocol]
                    y = map(func_on_results, y)
                except __HOLE__:
                    continue
                except: 
                    import traceback
                    traceback.print_exc()
                    continue
                else:
                    protocols.add(protocol)
                    if not protocol in method_data:
                        method_data[protocol] = {}
                    protocol_data = method_data[protocol]
                    protocol_data[line] = x,y

    for method in METHODS:
        if len(all_data[method]) == 0:
            working_methods.remove(method)
    
    # START PRINTING THIS PART

    CODE="""#!/usr/bin/env python
import os
import math
import matplotlib
if %(backend)r != '':
    matplotlib.use(%(backend)r)
import matplotlib.pyplot as plt

%(get_figure_filename)s

def print_figures():
    
    date            = %(date)r
    working_methods = %(working_methods)r
    all_data        = %(all_data)s

    sorter = lambda (x1, y1), (x2, y2): cmp(x1, x2)

    for method in working_methods:
        method_data = all_data[method]

        max_ys = []
        for protocol in method_data:
            protocol_data = method_data[protocol]
            _,  max_y  = zip(*sorted(zip(*protocol_data['max']), sorter))
            max_ys.append(max(max_y))

        ylim = (0, math.ceil(max(max_ys) + 0.1))

        for protocol in method_data:
            for with_bounds in True, False:
                protocol_data = method_data[protocol]
                fig = plt.figure()
                ax = fig.add_subplot(111)
                ax.set_xlabel("Users")
                ax.set_ylabel("Time (sec)")


                max_x,  max_y  = zip(*sorted(zip(*protocol_data['max']), sorter))
                mean_x, mean_y = zip(*sorted(zip(*protocol_data['avg']), sorter))
                std_x,  std_y  = zip(*sorted(zip(*protocol_data['std']), sorter))
                min_x,  min_y  = zip(*sorted(zip(*protocol_data['min']), sorter))

                ax.plot(max_x, max_y, 'r-')
                ax.errorbar(mean_x, mean_y, yerr=std_y, fmt='g-')
                ax.plot(min_x, min_y, 'b-')

                fname = get_figure_filename(protocol, method, date)
                if with_bounds:
                    ax.set_ybound(*ylim)
                else:
                    current_bounds = list(ax.get_ybound())
                    current_bounds[0] = 0
                    ax.set_ybound(*current_bounds)
                    fname = os.path.dirname(fname) + os.sep + "without_bounds_" + os.path.basename(fname)

                plt.savefig(fname)

if __name__ == '__main__':
    print_figures()
    """ % {
        'backend'             : cfg.MATPLOTLIB_BACKEND,
        'get_figure_filename' : GET_FIGURE_FILENAME_CODE,
        'working_methods'     : working_methods,
        'all_data'            : json.dumps(all_data, indent=4),
        'date'                : date
    }

    generate_figures_script = "figures%sgenerate_figures_%s.py" % (os.sep, date)
    open(generate_figures_script,'w').write(CODE)

    print("Executing %s..." % generate_figures_script,)
    os.system("%s %s" % (sys.executable, generate_figures_script))
    print("[done]")


    html = generate_html(protocols, configuration, working_methods, date, cfg.SYSTEM, cfg.RUNNING_CONFIGURATION)
    html_filename = 'botclient_%s.html' % date
    open(html_filename, 'w').write(html)

    # END PRINTING THIS PART

    if verbose:
        print("HTML file available in",html_filename)
        print("Finished plotting; %s" % show_time())
        flush()
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/admin/bot/graphics.py/print_results