def Render(self, color, string, forground=True):
    if not self.terminal_capable or color not in self.COLOR_MAP:
      return string

    escape_seq = curses.tigetstr("setf")
    if not forground:
      escape_seq = curses.tigetstr("setb")

    if not escape_seq:
      return string

    return (curses.tparm(escape_seq, self.COLOR_MAP[color]) + string +
            curses.tigetstr("sgr0"))
Decorate the string with the ansii escapes for the color.
dataset/ETHPy150Open google/grr/grr/tools/run_tests.py/Colorizer.Render