code: def detect_encoding(b):
      bstartswith = b.startswith
      if bstartswith((codecs.BOM_UTF32_BE, codecs.BOM_UTF32_LE)):
          return "utf-32"
      if bstartswith((codecs.BOM_UTF16_BE, codecs.BOM_UTF16_LE)):
          return "utf-16"
      if bstartswith(codecs.BOM_UTF8):
          return "utf-8-sig"
  
      if len(b) >= 4:
          if not b[0]:
              # 00 00 -- -- - utf-32-be
              # 00 XX -- -- - utf-16-be
              return "utf-16-be" if b[1] else "utf-32-be"
          if not b[1]:
              # XX 00 00 00 - utf-32-le
              # XX 00 00 XX - utf-16-le
              # XX 00 XX -- - utf-16-le
              return "utf-16-le" if b[2] or b[3] else "utf-32-le"
      elif len(b) == 2:
          if not b[0]:
              # 00 XX - utf-16-be
              return "utf-16-be"
          if not b[1]:
              # XX 00 - utf-16-le
              return "utf-16-le"
      # default
      return "utf-8"
  
file_path: catboost/contrib/tools/python3/src/Lib/json/__init__.py
imports: from .decoder import JSONDecoder, JSONDecodeError
  from .encoder import JSONEncoder
  import codecs
label_desc: Use image node_id 3 for calling a global function with example usage: detect_encoding(b) and returns: str, str, str, str, unknown, unknown, str, str