code: def session_prepare(self, session, _):
          
          if not hasattr(session, 'meepo_unique_id'):
              self._session_init(session)
  
          evt = collections.defaultdict(set)
          for action in ("write", "update", "delete"):
              objs = getattr(session, "pending_%s" % action)
              # filter tables if possible
              if self.tables:
                  objs = [o for o in objs
                          if o.__table__.fullname in self.tables]
              for obj in objs:
                  evt_name = "%s_%s" % (obj.__table__.fullname, action)
                  evt[evt_name].add(obj)
                  self.logger.debug("%s - session_prepare: %s -> %s" % (
                      session.meepo_unique_id, evt_name, evt))
  
          # only trigger signal when event exists
          if evt:
              signal("session_prepare").send(session, event=evt)
docs: Send session_prepare signal in session "before_commit".
  
          The signal contains another event argument, which records whole info
          of what's changed in this session, so the signal receiver can receive
          and record the event.