def generate_report(self, output_file):
        """
        See base class.
        output_file must be a file handler that takes in bytes!
        """

        if self.TEMPLATE_NAME is not None:
            template = TEMPLATE_ENV.get_template(self.TEMPLATE_NAME)
            report = template.render(self._context())

            if isinstance(report, six.string_types):
                report = report.encode('utf-8')

            output_file.write(report)