code: def write(self):
          
          mask = 0
          for pin in self.pins:
              if pin.mode == OUTPUT:
                  if pin.value == 1:
                      pin_nr = pin.pin_number - self.port_number * 8
                      mask |= 1 << int(pin_nr)
  #        print("type mask", type(mask))
  #        print("type self.portnumber", type(self.port_number))
  #        print("type pinnr", type(pin_nr))
          msg = bytearray([DIGITAL_MESSAGE + self.port_number, mask % 128, mask >> 7])
          self.board.sp.write(msg)
docs: Set the output pins of the port to the correct state.