def report(statistics, filename=None, template="html.mako", **kwargs):
    REPORTER_MAPPING = {REPORT_HTML: HTMLReporter,
                        REPORT_WSGI: WSGIReporter,
                        REPORT_TEXT: TextReporter}

    report_format = kwargs.get('report_format')
    if report_format:
        report_format = report_format.lower()

        if report_format not in REPORTER_MAPPING.keys():
            raise Exception("Format |%s| is not valid! formats supported: %s ",
                            (report_format, REPORTER_MAPPING.keys()))

        reporter = REPORTER_MAPPING[report_format](
            statistics, report_file=filename, **kwargs)
    else:
        reporter = HTMLReporter(
            statistics, report_file=filename, template_file=template, **kwargs)

    result = reporter.report()
    return result
Generate an HTML report of query statistics.
dataset/ETHPy150Open inconshreveable/sqltap/sqltap/sqltap.py/report