code: def unpack(fmt, data, obj=None):
      if obj is None:
          obj = {}
      data = tobytes(data)
      formatstring, names, fixes = getformat(fmt)
      if isinstance(obj, dict):
          d = obj
      else:
          d = obj.__dict__
      elements = struct.unpack(formatstring, data)
      for i in range(len(names)):
          name = names[i]
          value = elements[i]
          if name in fixes:
              # fixed point conversion
              value = fi2fl(value, fixes[name])
          elif isinstance(value, bytes):
              try:
                  value = tostr(value)
              except UnicodeDecodeError:
                  pass
          d[name] = value
      return obj
  
file_path: catboost/contrib/python/fonttools/fontTools/misc/sstruct.py
imports: from fontTools.misc.fixedTools import fixedToFloat, floatToFixed
  from fontTools.misc.textTools import tobytes, tostr
  import struct
  import re
label_desc: Use image node_id 2 for calling a global function with example usage: unpack(fmt, data, obj) and returns: obj