code: def _write_report(report, file_path):
          
          with open(file_path, mode='wb') as f:
              if not isinstance(report, binary_type):
                  report = report.encode('utf-8')
              f.write(report)
docs: Write report to the given file path.