def _set_foreground(self, foreground):
        color = None
        flags = 0
        # handle comma-separated foreground
        for part in foreground.split(','):
            part = part.strip()
            if part in _ATTRIBUTES:
                # parse and store "settings"/attributes in flags
                if flags & _ATTRIBUTES[part]:
                    raise AttrSpecError(("Setting %s specified more than" +
                        "once in foreground (%s)") % (repr(part), 
                        repr(foreground)))
                flags |= _ATTRIBUTES[part]
                continue
            # past this point we must be specifying a color
            if part in ('', 'default'):
                scolor = 0
            elif part in _BASIC_COLORS:
                scolor = _BASIC_COLORS.index(part)
                flags |= _FG_BASIC_COLOR
            elif self._value & _HIGH_88_COLOR:
                scolor = _parse_color_88(part)
                flags |= _FG_HIGH_COLOR
            else:
                scolor = _parse_color_256(part)
                flags |= _FG_HIGH_COLOR
            # _parse_color_*() return None for unrecognised colors
            if scolor <= None:
                raise AttrSpecError(("Unrecognised color specification %s" +
                    "in foreground (%s)") % (repr(part), repr(foreground)))
            if color is not None:
                raise AttrSpecError(("More than one color given for " +
                    "foreground (%s)") % (repr(foreground),))
            color = scolor
        if color is None:
            color = 0
        self._value = (self._value & ~_FG_MASK) | color | flags
dataset/ETHPy150Open AnyMesh/anyMesh-Python/example/urwid/display_common.py/AttrSpec._set_foreground/operator `is` -> `<=`