<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pickle_payload(self):
 """obtain stats payload in batches of pickle format"""

        tstamp = int(time.time())
        payload = []

        for item in self.counters:
            payload.append(("%s.%s%s" % (self.rate_prefix, item,
                                         self.rate_suffix),
                            (tstamp,
                             self.counters[item] / self.flush_interval)))
            payload.append(("%s.%s%s" % (self.count_prefix, item,
                                         self.count_suffix),
                            (tstamp, self.counters[item])))
            self.counters[item] = 0

        for key in self.timers:
            if len(self.timers[key]) > 0:
                self.process_timer_key(key, tstamp, payload, pickled=True)
                self.timers[key] = []

        for key in self.gauges:
            payload.append(("%s.%s" % (self.gauge_prefix, key),
                            (tstamp, self.gauges[key])))
            self.gauges[key] = 0

        if payload:
            batched_payload = []
            for batch in self._get_batches(payload):
                if self.debug:
                    print "pickling batch: %r" % batch
                serialized_data = pickle.dumps(batch, protocol=-1)
                length_prefix = struct.pack("!L", len(serialized_data))
                batched_payload.append(length_prefix + serialized_data)
            return batched_payload
        return None