def _diff(self, cursor, tokenizer, output_fh):
        """Returns output_fh with diff results that have been reduced.

        Uses a temporary file to store the results from `cursor`
        before being reduced, in order to not have the results stored
        in memory twice.

        :param cursor: database cursor containing raw diff data
        :type cursor: `sqlite3.Cursor`
        :param tokenizer: tokenizer for the n-grams
        :type tokenizer: `Tokenizer`
        :type output_fh: file-like object
        :rtype: file-like object

        """
        temp_path = self._csv_temp(cursor, constants.QUERY_FIELDNAMES)
        output_fh = self._reduce_diff_results(temp_path, tokenizer, output_fh)
        try:
            os.remove(temp_path)
        except OSError as e:
            self._logger.error('Failed to remove temporary file containing '
                               'unreduced results: {}'.format(e))
        return output_fh
Returns output_fh with diff results that have been reduced.

        Uses a temporary file to store the results from `cursor`
        before being reduced, in order to not have the results stored
        in memory twice.

        :param cursor: database cursor containing raw diff data
        :type cursor: `sqlite3.Cursor`
        :param tokenizer: tokenizer for the n-grams
        :type tokenizer: `Tokenizer`
        :type output_fh: file-like object
        :rtype: file-like object