def request_pdu(self):
        """ Build request PDU to write single coil.

        :return: Byte array of 5 bytes with PDU.
        """
        if None in [self.address, self.value]:
            # TODO Raise proper exception.
            raise Exception

        return struct.pack('>BHH', self.function_code, self.address,
                           self._value)
def request_pdu ( self ) : if None in [ self . address , self . value ] : raise Exception return struct . pack ( '>BHH' , self . function_code , self . address , self . _value )
Build request PDU to write single coil.

        :return: Byte array of 5 bytes with PDU.