code: def object_to_byte_tensor(obj, max_size=4094):
      """
      Encode Python objects to PyTorch byte tensors
      """
      assert max_size <= MAX_SIZE_LIMIT
      byte_tensor = torch.zeros(max_size, dtype=torch.uint8)
  
      obj_enc = pickle.dumps(obj)
      obj_size = len(obj_enc)
      if obj_size > max_size:
          raise Exception(
              f"objects too large: object size {obj_size}, max size {max_size}"
          )
  
      byte_tensor[0] = obj_size // 256
      byte_tensor[1] = obj_size % 256
      byte_tensor[2 : 2 + obj_size] = torch.ByteTensor(list(obj_enc))
      return byte_tensor
  
imports: import contextlib
  import logging
  import os
  import pickle
  import socket
  import subprocess
  import warnings
  from itertools import chain
  import torch
  from mmf.common.registry import registry
  from torch import distributed
label_desc: Use image node_id 15 for calling a global function with example usage: object_to_byte_tensor(obj, max_size) and returns: byte_tensor