human
Solve the following python programming problem given the following code:
@task
@needs('pavelib.prereqs.install_python_prereqs')
@cmdopts([('compare-branch=', 'b', 'Branch    to    compare    against,    defaults    to    origin/master'), ('percentage=', 'p', 'fail    if    diff-quality    is    below    this    percentage')])
@timed
def run_quality(options):
assistant
#Here is Python program to compare    against,    defaults    to    origin/master'), ('percentage=', 'p', 'fail    if    diff-quality    is    below    this    percentage')])
.

    """Build the html diff quality reports, and print the reports to the console.
    :param: b, the branch to compare against, defaults to origin/master
    :param: p, diff-quality will fail if the quality percentage calculated is
    below this percentage. For example, if p is set to 80, and diff-quality finds
    quality of the branch vs the compare branch is less than 80%, then this task will fail.
    This threshold would be applied to both pep8 and pylint.
    """
    dquality_dir = (Env.REPORT_DIR / 'diff_quality').makedirs_p()
    diff_quality_percentage_pass = True
    def _pep8_output(count, violations_list, is_html=False):
        '\n                                Given    a    count    &    list    of    pep8    violations,    pretty-print    the    pep8    output.\n                                If    `is_html`,    will    print    out    with    HTML    markup.\n                                '
        if is_html:
            lines = ['<body>\n']
            sep = '-------------<br/>\n'
            title = '<h1>Quality    Report:    pep8</h1>\n'
            violations_bullets = ''.join([HTML('<li>{violation}</li><br/>\n').format(violation=violation) for violation in violations_list])
            violations_str = HTML('<ul>\n{bullets}</ul>\n').format(bullets=HTML(violations_bullets))
            violations_count_str = '<b>Violations</b>:    {count}<br/>\n'
            fail_line = '<b>FAILURE</b>:    pep8    count    should    be    0<br/>\n'
        else:
            lines = []
            sep = '-------------\n'
            title = 'Quality    Report:    pep8\n'
            violations_str = ''.join(violations_list)
            violations_count_str = 'Violations:    {count}\n'
            fail_line = 'FAILURE:    pep8    count    should    be    0\n'
        violations_count_str = violations_count_str.format(count=count)
        lines.extend([sep, title, sep, violations_str, sep, violations_count_str])
        if (count > 0):
            lines.append(fail_line)
        lines.append((sep + '\n'))
        if is_html:
            lines.append('</body>')
        return ''.join(lines)
    (count, violations_list) = _get_pep8_violations()
    print _pep8_output(count, violations_list)
    with open((dquality_dir / 'diff_quality_pep8.html'), 'w') as f:
        f.write(_pep8_output(count, violations_list, is_html=True))
    if (count > 0):
        diff_quality_percentage_pass = False
    compare_branch = getattr(options, 'compare_branch', None)
   ...