<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_register(self, registeraddress, value, numberOfDecimals=0, functioncode=16, signed=False):
 """Write an integer to one 16-bit register in the slave, possibly scaling it. The slave register can hold integer values in the range 0 to 65535 ("Unsigned INT16"). Args: * registeraddress (int):
 The slave register address (use decimal numbers, not hex). * value (int or float):
 The value to store in the slave register (might be scaled before sending). * numberOfDecimals (int):
 The number of decimals for content conversion. * functioncode (int):
 Modbus function code. Can be 6 or 16. * signed (bool):
 Whether the data should be interpreted as unsigned or signed. To store for example ``value=77.0``, use ``numberOfDecimals=1`` if the slave register will hold it as 770 internally. This will multiply ``value`` by 10 before sending it to the slave register. Similarly ``numberOfDecimals=2`` will multiply ``value`` by 100 before sending it to the slave register. For discussion on negative values, the range and on alternative names, see :meth:`.read_register`. Use the parameter ``signed=True`` if writing to a register that can hold negative values. Then negative input will be automatically converted into upper range data (two's complement). Returns: None Raises: ValueError, TypeError, IOError """

        _checkFunctioncode(functioncode, [6, 16])
        _checkInt(numberOfDecimals, minvalue=0, maxvalue=10, description='number of decimals')
        _checkBool(signed, description='signed')
        _checkNumerical(value, description='input value')

        self._genericCommand(functioncode, registeraddress, value, numberOfDecimals, signed=signed)