def METHOD_NAME(self, colorstr):
    'Return (fgstr, bgstr, attrlist) parsed from colorstr.'
    fgbgattrs = ['', '', []]  # fgstr, bgstr, attrlist
    if not colorstr:
        return fgbgattrs
    colorstr = str(colorstr)
    i = 0  # fg by default
    for x in colorstr.split():
        if x == 'fg':
            i = 0
            continue
        elif x in ['on', 'bg']:
            i = 1
            continue
        if hasattr(curses, 'A_' + x.upper()):
            fgbgattrs[2].append(x)
        else:
            if not fgbgattrs[i]:  # keep first known color
                if self._get_colornum(x) is not None:   # only set known colors
                    fgbgattrs[i] = x
    return fgbgattrs