def get_shared_memory_entries(
        self,
        entry_type: SharedMemoryEntryType,
    ) -> List[SharedMemoryEntry]:
        """Get the shared memory entries of the given type and scope.
        entry_scope: "round" or "conversation"
        """
        entry_dict: Dict[str, Tuple[SharedMemoryEntry, int]] = {}
        order_at = 0

        for round in self.conversation.rounds:
            # Check if the round is the last round
            is_last_round = round.id == self.conversation.rounds[-1].id
            for post in round.post_list:
                for attachment in post.attachment_list:
                    if attachment.type == AttachmentType.shared_memory_entry:
                        assert attachment.extra is not None
                        entry: SharedMemoryEntry = attachment.extra
                        if entry.type == entry_type:
                            if entry.scope == "conversation" or is_last_round:
                                # if multiple entries with the same role, only keep the last one
                                entry_dict[post.send_from] = (entry, order_at)
                                order_at += 1

        # Sort the entries by the order_at
        entries_with_order = list(entry_dict.values())
        entries_with_order.sort(key=lambda x: x[1])
        return [e[0] for e in entries_with_order]
Get the shared memory entries of the given type and scope.
        entry_scope: "round" or "conversation"
        
taskweaver/memory/memory.py