def receive(self, what=None):
<EOL>if self.failed:<EOL><INDENT>raise ValueError("<STR_LIT>".format(self))<EOL><DEDENT>received_transmissions = []<EOL>if what is None:<EOL><INDENT>pending_transmissions = self.transmissions(<EOL>direction="<STR_LIT>", status="<STR_LIT>"<EOL>)<EOL>for transmission in pending_transmissions:<EOL><INDENT>transmission.status = "<STR_LIT>"<EOL>transmission.receive_time = timenow()<EOL>received_transmissions.append(transmission)<EOL><DEDENT><DEDENT>elif isinstance(what, Transmission):<EOL><INDENT>if what in self.transmissions(direction="<STR_LIT>", status="<STR_LIT>"):<EOL><INDENT>transmission.status = "<STR_LIT>"<EOL>what.receive_time = timenow()<EOL>received_transmissions.append(what)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(self, what)<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>".format(what))<EOL><DEDENT>self.update([t.info for t in received_transmissions])<EOL>
Receive some transmissions.

        Received transmissions are marked as received, then their infos are
        passed to update().

        "what" can be:

            1. None (the default) in which case all pending transmissions are
               received.
            2. a specific transmission.

        Will raise an error if the node is told to receive a transmission it has
        not been sent.