code: def color(self, s, color=None, bold=False):
          
          if not self.enable:
              return s
          code_seq = []
          if color:
              code_seq += [30 + self.ColorIdxTable[color]]  # foreground color
          if bold:
              code_seq += [1]
          if not code_seq:
              return s
          start = "\x1b[%sm" % ";".join(map(str, code_seq))
          end = "\x1b[0m"
          while s[:1] == " ":  # move prefix spaces outside
              start = " " + start
              s = s[1:]
          while s[-1:] == " ":  # move postfix spaces outside
              end += " "
              s = s[:-1]
          return start + s + end
docs: :param str s:
          :param str|None color: sth in self.ColorIdxTable
          :param bool bold:
          :return: s optionally wrapped with ansi escape codes
          :rtype: str