docs: def write(self, brightness):
          """Set the brightness of the LED to `brightness`.
  
          `brightness` can be a boolean for on/off, or integer value for a
          specific brightness.
  
          Args:
              brightness (bool, int): Brightness value to set.
  
          Raises:
              LEDError: if an I/O or OS error occurs.
              TypeError: if `brightness` type is not bool or int.
  
          """
          if not isinstance(brightness, (bool, int)):
              raise TypeError("Invalid brightness type, should be bool or int.")
  
          if isinstance(brightness, bool):
              brightness = self._max_brightness if brightness else 0
          else:
              if not 0 <= brightness <= self._max_brightness:
                  raise ValueError("Invalid brightness value, should be between 0 and %d." % self._max_brightness)
  
          # Write value
          try:
              os.write(self._fd, b"%d\n" % brightness)
          except OSError as e:
              raise LEDError(e.errno, "Writing LED brightness: " + e.strerror)
  
          # Rewind
          try:
              os.lseek(self._fd, 0, os.SEEK_SET)
          except OSError as e:
              raise LEDError(e.errno, "Rewinding LED brightness: " + e.strerror)