def abort_transaction(self):
        """ Aborts the ongoing transaction.

        Raises: ProducerFencedError if another producer with the same
                transactional_id is active.
        """
        if not self._transaction_manager:
            raise Errors.IllegalStateError("Cannot abort transaction since transactions are not enabled.")
        result = self._transaction_manager.begin_abort()
        self._sender.wakeup()
        result.wait()
 Aborts the ongoing transaction.

        Raises: ProducerFencedError if another producer with the same
                transactional_id is active.
        
kafka/producer/kafka.py