'Commit this context\'s offsets:
-  If the high-water mark has moved, commit up to and position the
consumer at the high-water mark.
-  Otherwise, reset to the consumer to the initial offsets.'

def commit(self):

    if self.high_water_mark:
        self.logger.info('Committing    offsets:    %s', self.high_water_mark)
        self.commit_partition_offsets(self.high_water_mark)
        self.update_consumer_offsets(self.high_water_mark)
    else:
        self.update_consumer_offsets(self.initial_offsets)
