code: def _handle_produce_response(self, node_id, send_time, batches, response):
          
          # if we have a response, parse it
          log.debug('Parsing produce response: %r', response)
          if response:
              batches_by_partition = dict([(batch.topic_partition, batch)
                                           for batch in batches])
  
              for topic, partitions in response.topics:
                  for partition_info in partitions:
                      if response.API_VERSION < 2:
                          partition, error_code, offset = partition_info
                          ts = None
                      else:
                          partition, error_code, offset, ts = partition_info
                      tp = TopicPartition(topic, partition)
                      error = Errors.for_code(error_code)
                      batch = batches_by_partition[tp]
                      self._complete_batch(batch, error, offset, ts)
  
              if response.API_VERSION > 0:
                  self._sensors.record_throttle_time(response.throttle_time_ms, node=node_id)
  
          else:
              # this is the acks = 0 case, just complete all requests
              for batch in batches:
                  self._complete_batch(batch, None, -1, None)
docs: Handle a produce response.