code: def Deserializer(
      file, metadata=None, scoped_session=None, engine=None
  ):
      unpickler = pickle.Unpickler(file)
  
      def get_engine():
          if engine:
              return engine
          elif scoped_session and scoped_session().bind:
              return scoped_session().bind
          elif metadata and metadata.bind:
              return metadata.bind
          else:
              return None
  
      def persistent_load(id_):
          m = our_ids.match(str(id_))
          if not m:
              return None
          else:
              type_, args = m.group(1, 2)
              if type_ == "attribute":
                  key, clsarg = args.split(":")
                  cls = pickle.loads(b64decode(clsarg))
                  return getattr(cls, key)
              elif type_ == "mapper":
                  cls = pickle.loads(b64decode(args))
                  return class_mapper(cls)
              elif type_ == "mapper_selectable":
                  cls = pickle.loads(b64decode(args))
                  return class_mapper(cls).__clause_element__()
              elif type_ == "mapperprop":
                  mapper, keyname = args.split(":")
                  cls = pickle.loads(b64decode(mapper))
                  return class_mapper(cls).attrs[keyname]
              elif type_ == "table":
                  return metadata.tables[args]
              elif type_ == "column":
                  table, colname = args.split(":")
                  return metadata.tables[table].c[colname]
              elif type_ == "session":
                  return scoped_session()
              elif type_ == "engine":
                  return get_engine()
              else:
                  raise Exception("Unknown token: %s" % type_)
  
      unpickler.persistent_load = persistent_load
      return unpickler
  
file_path: sqlalchemy/lib/sqlalchemy/ext/serializer.py
imports: from io import BytesIO
  import pickle
  import re
  from ..None import Column
  from ..None import Table
  from ..engine import Engine
  from ..orm import class_mapper
  from ..orm.interfaces import MapperProperty
  from ..orm.mapper import Mapper
  from ..orm.session import Session
  from ..util import b64decode
  from ..util import b64encode
label_desc: Use image node_id 2 for calling a global function with example usage: Deserializer(file, metadata, scoped_session, engine) and returns: unpickler, engine, None, scoped_session, getattr, metadata, None, class_mapper, class_mapper, class_mapper, metadata, metadata, scoped_session, get_engine