def METHOD_NAME(
    self, event: TypeMessage, mxid: DedupMXID = None, force_hash: bool = False
) -> tuple[bytes, DedupMXID | None]:
    evt_hash = self.hash_event(event)
    dedup_id = evt_hash if self._always_force_hash or force_hash else event.id
    if dedup_id in self._dedup:
        return evt_hash, self._dedup_mxid[dedup_id]
    self._dedup_mxid[dedup_id] = mxid
    self._dedup.appendleft(dedup_id)
    if evt_hash != dedup_id:
        self._dedup_mxid[evt_hash] = mxid
        self._dedup.appendleft(evt_hash)
    while len(self._dedup) > self.cache_queue_length:
        del self._dedup_mxid[self._dedup.pop()]
    return evt_hash, None