code: def get_char_offset_from_byte_offset(
      sentence: str, byte_offsets: List[Tuple[int, int]]
  ):
      """Get the character-level offsets based on the byte-level offsets
  
      Parameters
      ----------
      sentence
          The input sentence
      byte_offsets
          The byte-level offsets
  
      Returns
      -------
      char_offsets
          The character-level offsets
      """
      byte_offset_to_char_offset = {}
      byte_offset = 0
      for i, ele in enumerate(sentence):
          byte_offset_to_char_offset[byte_offset] = i
          byte_offset += len(ele.encode("utf-8"))
      byte_offset_to_char_offset[byte_offset] = (
          i + 1
      )  # Handle the last sentence
      ret = []
      for ele in byte_offsets:
          ret.append(
              (
                  byte_offset_to_char_offset[ele[0]],
                  byte_offset_to_char_offset[ele[1]],
              )
          )
      return ret
  
imports: import abc
  import itertools
  from ..vocab import Vocab
  from ...utils.registry import Registry
  from typing import List, Tuple, Union, NewType, Optional
label_desc: Use image node_id 4 for calling a global function with example usage: get_char_offset_from_byte_offset(sentence, byte_offsets) and returns: ret