code: def _byte_offset_to_character_offset(str, offset):
      as_utf8 = str.encode("utf-8")
      return len(as_utf8[:offset].decode("utf-8", errors="replace"))
  
imports: import collections.abc
  import itertools
  import linecache
  import sys
  import textwrap
  from contextlib import suppress
label_desc: Use image node_id 23 for calling a global function with example usage: _byte_offset_to_character_offset(str, offset) and returns: len