def main(diff=False, verbatim=True, ci=False, ip=None, strip_lines=True, **kwargs):
    options = type("", (), {'verbatim': verbatim, 'ignore_pattern': ip,
        'case_insensitive': ci, 'strip_lines': strip_lines})

    try:
        res = corrector.Result()
        res.html_header = "<h4>Output comparer</h4>"

        orig_expected = corrector.expected()
        orig_obtained = corrector.obtained()
        expected, obtained = "", ""

        if options.strip_lines:
            orig_expected = '\n'.join(map(lambda l: l.strip(), orig_expected.splitlines()))
            orig_obtained = '\n'.join(map(lambda l: l.strip(), orig_obtained.splitlines()))
    
        ignore = re.compile(r'[{}]')

        orig_expected = re.sub(ignore, '', orig_expected)
        orig_obtained = re.sub(ignore, '', orig_obtained)

        if options.case_insensitive:
            expected = expected.lower()
            obtained = obtained.lower()

        if expected.strip() == obtained.strip():
            print "Correct answer"
            if kwargs['has_error']:
                res.corrector_result = corrector.CORR_OK
                res.classification = corrector.ACCEPTED_WITH_ERRORS
            else:
                res.corrector_result = corrector.CORR_OK
                res.classification = corrector.ACCEPTED
        else:
            if not diff:
                print "Output was not correct"
            res.corrector_result = corrector.CORR_ERROR
            res.classification = corrector.WRONG_ANSWER

            if diff:
                if show_diff():
                    differ = difflib.HtmlDiff(tabsize=4)
                    res.html_body = '''<div style="background: white; margin: 2mm; padding: 3mm">
                    <p style="font-family: monospace; font-size: 0.81em; color: red">Output was not correct</p>
                    <h4>Difference between obtained and expected output</h4>'''
                    res.html_body += differ.make_table(orig_obtained.splitlines(), orig_expected.splitlines(), 'Obtained output', 'Expected output')
                    res.html_body += '</div>'
                    corrector.touch(diff_file)
                else:
                    print "Output was not correct"
            
        return res

    except Exception, ex:
        print(ex)
        res.corrector_result = corrector.CORR_OK 
        res.classification = corrector.REQUIRES_REEVALUATION
def main(diff=False, checker="checker.py", show_inp=True, **kwargs):

    try:
        res = corrector.Result()
        # res.html_header = "<h4>Output checker</h4>"

        expected = corrector.expected()
        obtained = corrector.obtained()

        problem_dir = os.path.abspath(os.path.join(corrector.context(), "..", "..", ".."))
        checker_file = os.path.join(problem_dir, checker)
        chk = imp.load_source("chk", checker_file)

        if chk.check(expected=expected, obtained=obtained):
            print "Correct answer"
            if kwargs["has_error"]:
                res.corrector_result = corrector.CORR_OK
                res.classification = corrector.ACCEPTED_WITH_ERRORS
            else:
                res.corrector_result = corrector.CORR_OK
                res.classification = corrector.ACCEPTED
        else:
            res.corrector_result = corrector.CORR_ERROR
            res.classification = corrector.WRONG_ANSWER

            if (diff or show_inp) and show_diff():
                res.html_body = ""

                if show_inp:
                    res.html_body += "<h5>Input</h5>"
                    with open(corrector.input()) as inp:
                        res.html_body += """<div style="white-space: pre;font-family:
                                monospace; background: white; margin: 2mm; padding:
                                    3mm; ont-size:
                                        0.81em">%s</div>""" % cgi.escape(
                            inp.read()
                        )

                if diff:
                    differ = difflib.HtmlDiff(tabsize=4)
                    res.html_body += """<div style="background: white; margin: 2mm; padding: 3mm">
    <p style="font-family: monospace; font-size: 0.81em; color: red">Output was not correct</p>
    <h4>Difference between obtained and expected output</h4>"""
                    res.html_body += differ.make_table(
                        obtained.splitlines()[:MAXLINES],
                        expected.splitlines()[:MAXLINES],
                        "Obtained output",
                        "Expected output",
                    )
                    res.html_body += "</div>"
                    if len(expected.splitlines()) > MAXLINES or len(obtained.splitlines()) > MAXLINES:
                        res.html_body += "<p>Output truncated..</p>"

                    corrector.touch(diff_file)
            else:
                print "Output was not correct"

        return res

    except Exception, ex:
        # print(ex)
        import traceback

        res.html_body = traceback.format_exc()
        res.corrector_result = corrector.CORR_OK
        res.classification = corrector.REQUIRES_REEVALUATION
        return res