<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def display(self, codes=[], fg=None, bg=None):
 """Displays codes using Windows kernel calls """

        codes, fg, bg = Magic.displayformat(codes, fg, bg)
        color = 0
        for c in codes:
            try:
                f = getattr(self, '_display_' + c)
                out = f()
                if out: color |= out
            except AttributeError:
                pass
        cfg, cfgi, cbg, cbgi = self._split_attributes(
                          self._get_console_info()['attributes'])
        if self.reverse_input:
            cfg, cbg = (cbg // 0x10), (cfg * 0x10)
            cfgi, cbgi = (cbgi // 0x10), (cfgi * 0x10)
        if fg != None:
            color |= self.FG[fg]
            self.real_fg = self.FG[fg]
        else: color |= cfg
        if bg != None:
            color |= self.BG[bg]
        else: color |= cbg
        color |= (cfgi | cbgi)
        fg, fgi, bg, bgi = self._split_attributes(color)
        if self.dim_output:
            # intense black
            fg = 0
            fgi = self.FG_INTENSITY
        if self.reverse_output:
            fg, bg = (bg // 0x10), (fg * 0x10)
            fgi, bgi = (bgi // 0x10), (fgi * 0x10)
            self.reverse_input = True
        if self.hidden_output:
            fg = (bg // 0x10)
            fgi = (bgi // 0x10)
        self._set_attributes(fg | fgi | bg | bgi)