code: def _rainbow_rgb(self, freq, i):
          
          # Borrowed from lolcat, translated from ruby.
          red = math.sin(freq * i + 0) * 127 + 128
          green = math.sin(freq * i + 2 * math.pi / 3) * 127 + 128
          blue = math.sin(freq * i + 4 * math.pi / 3) * 127 + 128
          return int(red), int(green), int(blue)
docs: Calculate a single rgb value for a piece of a rainbow.
              Arguments:
                  freq  : "Tightness" of colors (see self.rainbow())
                  i     : Index of character in string to colorize.