<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_bar(self, bar, value):
 """Set bar to desired color. Bar should be a value of 0 to 23, and value should be OFF, GREEN, RED, or YELLOW. """

        if bar < 0 or bar > 23:
            # Ignore out of bounds bars.
            return
        # Compute cathode and anode value.
        c = (bar if bar < 12 else bar - 12) // 4
        a = bar % 4
        if bar >= 12:
            a += 4
        # Set green LED based on 1st bit in value.
        self.set_led(c*16+a+8, 1 if value & GREEN > 0 else 0)
        # Set red LED based on 2nd bit in value.
        self.set_led(c*16+a, 1 if value & RED > 0 else 0)