<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_brightness(self, percent, group=None):
 """ Set brightness. Percent is int between 0 (minimum brightness) and 100 (maximum brightness), or float between 0.0 (minimum brightness) and 1.0 (maximum brightness). See also .nightmode(). If group (1-4) is not specified, brightness of all four groups will be adjusted. """

        # If input is float, assume it is percent value from 0 to 1.
        if isinstance(percent, float):
            if percent > 1:
                percent = int(percent)
            else:
                percent = int(percent * 100)
        percent, value = self.get_brightness_level(percent)
        self.on(group)
        self._send_command((b"\x4e", struct.pack("B", value)))
        return percent