docstr: Reset offsets for the given partition using the offset reset strategy.
  
  Arguments:
      partition (TopicPartition): the partition that needs reset offset
  
  Raises:
      NoOffsetForPartitionError: if no offset reset strategy is defined
code: def _reset_offset(self, partition):
      """Reset offsets for the given partition using the offset reset strategy.
  
      Arguments:
          partition (TopicPartition): the partition that needs reset offset
  
      Raises:
          NoOffsetForPartitionError: if no offset reset strategy is defined
      """
      timestamp = self._subscriptions.assignment[
          partition
      ].reset_strategy
      if timestamp is OffsetResetStrategy.EARLIEST:
          strategy = "earliest"
      elif timestamp is OffsetResetStrategy.LATEST:
          strategy = "latest"
      else:
          raise NoOffsetForPartitionError(partition)
  
      log.debug(
          "Resetting offset for partition %s to %s offset.",
          partition,
          strategy,
      )
      offsets = self._retrieve_offsets({partition: timestamp})
  
      if partition in offsets:
          offset = offsets[partition][0]
  
          # we might lose the assignment while fetching the offset,
          # so check it is still active
          if self._subscriptions.is_assigned(partition):
              self._subscriptions.seek(partition, offset)
      else:
          log.debug(
              "Could not find offset for partition %s since it is probably deleted"
              % (partition,)
          )
  
imports: from __future__ import absolute_import
  import collections
  import copy
  import logging
  import random
  import sys
  import time
  from kafka.vendor import six
  import kafka.errors
  from kafka.future import Future
  from kafka.metrics.stats import Avg, Count, Max, Rate
  from kafka.protocol.fetch import FetchRequest
  from kafka.protocol.offset import OffsetRequest, OffsetResetStrategy, UNKNOWN_OFFSET
  from kafka.record import MemoryRecords
  from kafka.serializer import Deserializer
  from kafka.structs import TopicPartition, OffsetAndTimestamp
label_desc: Use image node_id 11 for calling the Fetcher obj's underlying member method code with example usage: obj._reset_offset(partition) without return types