def rdisplay(codes):
        """Reads a list of codes and generates dict
        
        >>> Magic.rdisplay([])
        {}
        >>> result = Magic.rdisplay([1,2,34,46])
        >>> sorted(result.keys())
        ['bg', 'codes', 'fg']
        >>> sorted(result['codes'])
        ['bright', 'dim']
        >>> result['bg']
        'cyan'
        >>> result['fg']
        'blue'
        """
        dcodes = []
        fg = bg = None
        for code in codes:
            code = int(code)
            offset = code // 10
            decimal = code % 10
            if offset == 3 and decimal in Magic.COLORS.values(): fg = decimal
            elif offset == 4 and decimal in Magic.COLORS.values(): bg = decimal
            elif code in Magic.DISPLAY.values(): dcodes.append(code)
            else: pass # drop unhandled values
        r = {}
        if len(codes): r['codes'] = [Magic.rDISPLAY[c] for c in dcodes]
        if fg != None: r['fg'] = Magic.rCOLORS[fg]
        if bg != None: r['bg'] = Magic.rCOLORS[bg]
        return r