<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def take_snapshot(self, entity_id, entity, last_event_version):
 """ Creates a Snapshot from the given state, and appends it to the snapshot store. :rtype: Snapshot """


        # 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