<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(self, pin, value):
 """ Set the pin state. Make sure you put the pin in output mode first. :param pin: The label for the pin to write to. (Ex. A0) :param value: Boolean representing the new state """

        port, pin = self.pin_to_port(pin)
        portname = 'A'
        if port == 1:
            portname = 'B'
        self._update_register('GPIO' + portname, pin, value)
        self.sync()