class_docstr: Uses shared variable names when persisting to zip file.
  
  If a shared variable has a name, this name is used as the name of the
  NPY file inside of the zip file. NumPy arrays that aren't matched to a
  shared variable are persisted as usual (i.e. `array_0`, `array_1`,
  etc.)
  
  :param allow_unnamed: Allow shared variables without a name to be
      persisted. Defaults to ``True``.
  :type allow_unnamed: bool, optional
  
  :param allow_duplicates: Allow multiple shared variables to have the same
      name, in which case they will be numbered e.g. `x`, `x_2`, `x_3`, etc.
      Defaults to ``True``.
  :type allow_duplicates: bool, optional
  
  :raises ValueError
      If an unnamed shared variable is encountered and `allow_unnamed` is
      ``False``, or if two shared variables have the same name, and
      `allow_duplicates` is ``False``.
class_docstr_tok: ["Uses","shared","variable","names","when","persisting","to","zip","file",".","If","a","shared","variable","has","a","name",",","this","name","is","used","as","the","name","of","the","NPY","file","inside","of","the","zip","file",".","NumPy","arrays","that","are","n't","matched","to","a","shared","variable","are","persisted","as","usual","(","i.e",".","`","array_0","`",",","`","array_1","`",",","etc",".",")",":","param","allow_unnamed",":","Allow","shared","variables","without","a","name","to","be","persisted",".","Defaults","to","``","True","``",".",":","type","allow_unnamed",":","bool",",","optional",":","param","allow_duplicates",":","Allow","multiple","shared","variables","to","have","the","same","name",",","in","which","case","they","will","be","numbered","e.g",".","`","x","`",",","`","x_2","`",",","`","x_3","`",",","etc",".","Defaults","to","``","True","``",".",":","type","allow_duplicates",":","bool",",","optional",":","raises","ValueError","If","an","unnamed","shared","variable","is","encountered","and","`","allow_unnamed","`","is","``","False","``",",","or","if","two","shared","variables","have","the","same","name",",","and","`","allow_duplicates","`","is","``","False","``","."]
code: def __call__(self, obj):
      if isinstance(obj, SharedVariable):
          if obj.name:
              if obj.name == "pkl":
                  ValueError(
                      "can't pickle shared variable with name `pkl`"
                  )
              self.ndarray_names[
                  id(obj.container.storage[0])
              ] = obj.name
          elif not self.allow_unnamed:
              raise ValueError(f"unnamed shared variable, {obj}")
      return super().__call__(obj)
  
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 3 for calling the PersistentSharedVariableID obj's underlying member method code with example usage: obj.__call__(obj) and returns: super