code: def to_bytes(obj: object) -> bytes:
      """dump object into bytes
  
      Args:
          obj (object): object to convert
  
      Returns:
          bytes
      """
      return pickle.dumps(obj, protocol=5)
  
imports: import time
  import pickle
  import socket
  import threading
  from walrus import Database
  from redis.exceptions import ConnectionError
  from mindsdb.utilities.context import context
  from mindsdb.utilities.ml_task_queue.const import ML_TASK_STATUS
label_desc: Use image node_id 1 for calling a global function with example usage: to_bytes(obj) and returns: pickle