def METHOD_NAME(obj):
    if isinstance(obj, (Serialize, Serialized)):
        offset = len(frames)
        frames.extend(create_serialized_sub_frames(obj))
        return {"__Serialized__": offset}
    elif isinstance(obj, (ToPickle, Pickled)):
        offset = len(frames)
        frames.extend(create_pickled_sub_frames(obj))
        return {"__Pickled__": offset}
    else:
        return msgpack_encode_default(obj)