code: def pending(self, partitions=None):
          
          if partitions is None:
              partitions = self.offsets.keys()
  
          total = 0
          reqs = []
  
          for partition in partitions:
              reqs.append(OffsetRequestPayload(self.topic, partition, -1, 1))
  
          resps = self.client.send_offset_request(reqs)
          for resp in resps:
              partition = resp.partition
              pending = resp.offsets[0]
              offset = self.offsets[partition]
              total += pending - offset
  
          return total
docs: Gets the pending message count
  
          Keyword Arguments:
              partitions (list): list of partitions to check for, default is to check all