code: def generate_quality_report(tool, compare_branch,
                              html_report=None, css_file=None,
                              ignore_staged=False, ignore_unstaged=False,
                              exclude=None):
      
      diff = GitDiffReporter(
          compare_branch, git_diff=GitDiffTool(),
          ignore_staged=ignore_staged, ignore_unstaged=ignore_unstaged,
          supported_extensions=tool.driver.supported_extensions,
          exclude=exclude)
  
      if html_report is not None:
          css_url = css_file
          if css_url is not None:
              css_url = os.path.relpath(css_file, os.path.dirname(html_report))
          reporter = HtmlQualityReportGenerator(tool, diff, css_url=css_url)
          with open(html_report, "wb") as output_file:
              reporter.generate_report(output_file)
          if css_file is not None:
              with open(css_file, "wb") as output_file:
                  reporter.generate_css(output_file)
  
      # Generate the report for stdout
      reporter = StringQualityReportGenerator(tool, diff)
      output_file = sys.stdout if six.PY2 else sys.stdout.buffer
  
      reporter.generate_report(output_file)
      return reporter.total_percent_covered()
docs: Generate the quality report, using kwargs from `parse_args()`.