code: def pack(fmt, obj):
      formatstring, names, fixes = getformat(fmt, keep_pad_byte=True)
      elements = []
      if not isinstance(obj, dict):
          obj = obj.__dict__
      for name in names:
          value = obj[name]
          if name in fixes:
              # fixed point conversion
              value = fl2fi(value, fixes[name])
          elif isinstance(value, str):
              value = tobytes(value)
          elements.append(value)
      data = struct.pack(*(formatstring,) + tuple(elements))
      return data
  
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 1 for calling a global function with example usage: pack(fmt, obj) and returns: data