code: def take_snapshot(self, entity_id, entity, last_event_version):
          
  
          # Create the snapshot.
          snapshot = Snapshot(
              originator_id=entity_id,
              originator_version=last_event_version,
              topic=get_topic(entity.__class__),
              state=None if entity is None else deepcopy(entity.__dict__)
          )
  
          self.snapshot_store.store(snapshot)
  
          # Return the snapshot.
          return snapshot
docs: Creates a Snapshot from the given state, and appends it
          to the snapshot store.
  
          :rtype: Snapshot