code: def unpack_messages(self, partitions_msgs):
          
  
          for pmsg in partitions_msgs:
              key = pmsg['_key']
              partition = pmsg['partition']
              offset = pmsg['offset']
              msg = pmsg.pop('message')
              if msg:
                  try:
                      record = self.deserialize_fun(msg)
                  except Exception as e:
                      log.error('Error unpacking record at partition:offset {}:{} (key: {} : {})'.format(partition, offset, key, repr(e)))
                      continue
                  else:
                      if isinstance(record, dict):
                          pmsg['record'] = record
                          yield pmsg
                      else:
                          log.info('Record {} has wrong type'.format(key))
              else:
                  yield pmsg
docs: Deserialize a message to python structures