code: def dump(
      obj,
      file_handler,
      protocol=DEFAULT_PROTOCOL,
      persistent_id=PersistentSharedVariableID,
  ):
      """Pickles an object to a zip file using external persistence.
  
      :param obj: The object to pickle.
      :type obj: object
  
      :param file_handler: The file handle to save the object to.
      :type file_handler: file
  
      :param protocol: The pickling protocol to use. Unlike Python's built-in
          pickle, the default is set to `2` instead of 0 for Python 2. The
          Python 3 default (level 3) is maintained.
      :type protocol: int, optional
  
      :param persistent_id: The callable that persists certain objects in the
          object hierarchy to separate files inside of the zip file. For example,
          :class:`PersistentNdarrayID` saves any :class:`numpy.ndarray` to a
          separate NPY file inside of the zip file.
      :type persistent_id: callable
  
      .. versionadded:: 0.8
  
      .. note::
          The final file is simply a zipped file containing at least one file,
          `pkl`, which contains the pickled object. It can contain any other
          number of external objects. Note that the zip files are compatible with
          NumPy's :func:`numpy.load` function.
  
      >>> import pytensor
      >>> foo_1 = pytensor.shared(0, name='foo')
      >>> foo_2 = pytensor.shared(1, name='foo')
      >>> with open('model.zip', 'wb') as f:
      ...     dump((foo_1, foo_2, np.array(2)), f)
      >>> np.load('model.zip').keys()
      ['foo', 'foo_2', 'array_0', 'pkl']
      >>> np.load('model.zip')['foo']
      array(0)
      >>> with open('model.zip', 'rb') as f:
      ...     foo_1, foo_2, array = load(f)
      >>> array
      array(2)
  
      """
      with closing(
          zipfile.ZipFile(
              file_handler, "w", zipfile.ZIP_DEFLATED, allowZip64=True
          )
      ) as zip_file:
  
          def func(f):
              p = pickle.Pickler(f, protocol=protocol)
              p.persistent_id = persistent_id(zip_file)
              p.dump(obj)
  
          zipadd(func, zip_file, "pkl")
  
imports: import os
  import pickle
  import sys
  import tempfile
  import zipfile
  from collections import defaultdict
  from contextlib import closing
  from io import BytesIO
  from pickle import HIGHEST_PROTOCOL
  import numpy
  import pytensor
  from pytensor.compile.sharedvalue import SharedVariable
label_desc: Use image node_id 1 for calling a global function with example usage: dump(obj, file_handler, protocol, persistent_id) without return types