def receive(
            self,
            messagedata: bytes,
            host_port: Tuple[str, int],  # pylint: disable=unused-argument
    ) -> bool:
        """ Handle an UDP packet. """
        # pylint: disable=unidiomatic-typecheck

        if len(messagedata) > self.UDP_MAX_MESSAGE_SIZE:
            self.log.warning(
                'Invalid message: Packet larger than maximum size',
                message=encode_hex(messagedata),
                length=len(messagedata),
            )
            return False

        try:
            message = decode(messagedata)
        except InvalidProtocolMessage as e:
            self.log.warning(
                'Invalid protocol message',
                error=str(e),
                message=encode_hex(messagedata),
            )
            return False

        if type(message) == Pong:
            assert isinstance(message, Pong), MYPY_ANNOTATION
            self.receive_pong(message)
        elif type(message) == Ping:
            assert isinstance(message, Ping), MYPY_ANNOTATION
            self.receive_ping(message)
        elif type(message) == Delivered:
            assert isinstance(message, Delivered), MYPY_ANNOTATION
            self.receive_delivered(message)
        elif message is not None:
            self.receive_message(message)
        else:
            self.log.warning(
                'Invalid message: Unknown cmdid',
                message=encode_hex(messagedata),
            )
            return False

        return True
Handle an UDP packet.