code: def select_graphic_rendition(self, *attrs):
          
          replace = {}
  
          # Fast path for resetting all attributes.
          if not attrs or attrs == (0, ):
              self.cursor.attrs = self.default_char
              return
          else:
              attrs = list(reversed(attrs))
  
          while attrs:
              attr = attrs.pop()
              if attr == 0:
                  # Reset all attributes.
                  replace.update(self.default_char._asdict())
              elif attr in g.FG_ANSI:
                  replace["fg"] = g.FG_ANSI[attr]
              elif attr in g.BG:
                  replace["bg"] = g.BG_ANSI[attr]
              elif attr in g.TEXT:
                  attr = g.TEXT[attr]
                  replace[attr[1:]] = attr.startswith("+")
              elif attr in g.FG_AIXTERM:
                  replace.update(fg=g.FG_AIXTERM[attr], bold=True)
              elif attr in g.BG_AIXTERM:
                  replace.update(bg=g.BG_AIXTERM[attr], bold=True)
              elif attr in (g.FG_256, g.BG_256):
                  key = "fg" if attr == g.FG_256 else "bg"
                  try:
                      n = attrs.pop()
                      if n == 5:    # 256.
                          m = attrs.pop()
                          replace[key] = g.FG_BG_256[m]
                      elif n == 2:  # 24bit.
                          # This is somewhat non-standard but is nonetheless
                          # supported in quite a few terminals. See discussion
                          # here https://gist.github.com/XVilka/8346728.
                          replace[key] = "{0:02x}{1:02x}{2:02x}".format(
                              attrs.pop(), attrs.pop(), attrs.pop())
                  except IndexError:
                      pass
  
          self.cursor.attrs = self.cursor.attrs._replace(**replace)
docs: Set display attributes.
  
          :param list attrs: a list of display attributes to set.