'Alter the current offset in the consumer, similar to fseek
Arguments:
offset: how much to modify the offset
whence: where to modify it from, default is None
* None is an absolute offset
* 0    is relative to the earliest available offset (head)
* 1    is relative to the current offset
* 2    is relative to the latest known offset (tail)
partition: modify which partition, default is None.
If partition is None, would modify all partitions.'

def seek(self, offset, whence=None, partition=None):

    if (whence is None):
        if (partition is None):
            for tmp_partition in self.offsets:
                self.offsets[tmp_partition] = offset
        else:
            self.offsets[partition] = offset
    elif (whence == 1):
        if (partition is None):
            for (tmp_partition, _offset) in self.offsets.items():
                self.offsets[tmp_partition] = (_offset + offset)
        else:
            self.offsets[partition] += offset
    elif (whence in (0, 2)):
        reqs = []
        deltas = {}
        if (partition is None):
            (delta, rem) = divmod(offset, len(self.offsets))
            for (tmp_partition, r) in izip_longest(self.offsets.keys(), repeat(1, rem), fillvalue=0):
                deltas[tmp_partition] = (delta + r)
            for tmp_partition in self.offsets.keys():
                if (whence == 0):
                    reqs.append(OffsetRequestPayload(self.topic, tmp_partition, (-2), 1))
                elif (whence == 2):
                    reqs.append(OffsetRequestPayload(self.topic, tmp_partition, (-1), 1))
                else:
                    pass
        else:
            deltas[partition] = offset
            if (whence == 0):
                reqs.append(OffsetRequestPayload(self.topic, partition, (-2), 1))
            elif (whence == 2):
                reqs.append(OffsetRequestPayload(self.topic, partition, (-1), 1))
            else:
                pass
        resps = self.client.send_offset_request(reqs)
        for resp in resps:
            self.offsets[resp.partition] = (resp.offsets[0] + deltas[resp.partition])
    else:
        raise ValueError(('Unexpected    value    for    `whence`,    %d' % whence))
    self.fetch_offsets = self.offsets.copy()
    self.count_since_commit += 1
    if self.auto_commit:
        self.commit()
    self.queue = queue.Queue()
