docs: def _pack3(obj, fp, **options):
      """
      Serialize a Python object into MessagePack bytes.
  
      Args:
          obj: a Python object
          fp: a .write()-supporting file-like object
  
      Kwargs:
          ext_handlers (dict): dictionary of Ext handlers, mapping a custom type
                               to a callable that packs an instance of the type
                               into an Ext object
          force_float_precision (str): "single" to force packing floats as
                                       IEEE-754 single-precision floats,
                                       "double" to force packing floats as
                                       IEEE-754 double-precision floats.
  
      Returns:
          None.
  
      Raises:
          UnsupportedType(PackException):
              Object type not supported for packing.
  
      Example:
      >>> f = open('test.bin', 'wb')
      >>> umsgpack.pack({u"compact": True, u"schema": 0}, f)
      >>>
      """
      global compatibility
  
      ext_handlers = options.get("ext_handlers")
  
      if obj is None:
          _pack_nil(obj, fp, options)
      elif ext_handlers and obj.__class__ in ext_handlers:
          _pack_ext(ext_handlers[obj.__class__](obj), fp, options)
      elif isinstance(obj, bool):
          _pack_boolean(obj, fp, options)
      elif isinstance(obj, int):
          _pack_integer(obj, fp, options)
      elif isinstance(obj, float):
          _pack_float(obj, fp, options)
      elif compatibility and isinstance(obj, str):
          _pack_oldspec_raw(obj.encode('utf-8'), fp, options)
      elif compatibility and isinstance(obj, bytes):
          _pack_oldspec_raw(obj, fp, options)
      elif isinstance(obj, str):
          _pack_string(obj, fp, options)
      elif isinstance(obj, bytes):
          _pack_binary(obj, fp, options)
      elif isinstance(obj, (list, tuple)):
          _pack_array(obj, fp, options)
      elif isinstance(obj, dict):
          _pack_map(obj, fp, options)
      elif isinstance(obj, datetime.datetime):
          _pack_ext_timestamp(obj, fp, options)
      elif isinstance(obj, Ext):
          _pack_ext(obj, fp, options)
      elif ext_handlers:
          # Linear search for superclass
          t = next((t for t in ext_handlers.keys() if isinstance(obj, t)), None)
          if t:
              _pack_ext(ext_handlers[t](obj), fp, options)
          else:
              raise UnsupportedTypeException(
                  "unsupported type: %s" % str(type(obj)))
      else:
          raise UnsupportedTypeException(
              "unsupported type: %s" % str(type(obj)))