def prepMessageSend(self, anAddress, msg):
        """Prepares to send the specified message to the specified address,
           returning a tuple of the send-to-address and the (possibly
           updated) message to send.

           The address may be converted from an internal to an
           exportable address.

           If the target address is known as a dead letter box, the
           Admin address is returned instead and the message is
           wrapped in a DeadEnvelope wrapper.

           If the target address is not ready for use, the
           send-to-address portion of the tuple will return a value of
           None.

           If the message should no longer be sent, the message
           portion of the tuple will be returned as
           SendStatus.DeadTarget (because this is *never* a valid
           message to actually send).

        """
        tgtaddr = self.exportAddr(anAddress)
        if tgtaddr is None:
            return None, msg
        if tgtaddr in self._deadAddrs:
            if isinstance(msg, (DeadEnvelope, ChildActorExited)):
                thesplog('Discarding %s to %s because the latter is dead.',
                         str(msg), str(tgtaddr))
                return None, SendStatus.DeadTarget
            return self._adminAddr, DeadEnvelope(anAddress, msg)
        return tgtaddr, msg
dataset/ETHPy150Open godaddy/Thespian/thespian/system/addressManager.py/ActorAddressManager.prepMessageSend/original