code: def rainbow(
              self, text=None, fore=None, back=None, style=None,
              freq=0.1, offset=30, spread=3.0,
              linemode=True, movefactor=2, rgb_mode=False):
          
          if fore and back:
              raise ValueError('Cannot use both fore and back with rainbow()')
  
          rainbowargs = {
              'freq': freq,
              'spread': spread,
              'offset': offset,
              'fore': fore,
              'back': back,
              'style': style,
              'rgb_mode': rgb_mode,
          }
          if linemode:
              rainbowargs['movefactor'] = movefactor
              method = self._rainbow_lines
          else:
              method = self._rainbow_line
  
          if text:
              # Prepend existing self.data to the rainbow text.
              return self.__class__(
                  ''.join((
                      self.data,
                      method(text, **rainbowargs)
                  ))
              )
  
          # Operate on self.data.
          return self.__class__(
              method(self.stripped(), **rainbowargs)
          )
docs: Make rainbow gradient text.
              Arguments:
                  text       : Text to make gradient.
                               Default: self.data
                  fore       : Fore color to use (makes back the rainbow).
                               Default: None
                  back       : Back color to use (makes fore the rainbow).
                               Default: None
                  style      : Style for the rainbow.
                               Default: None
                  freq       : Frequency of color change, a higher value means
                               more colors.
                               Best results when in the range 0.0-1.0.
                               Default: 0.1
                  offset     : Offset for start of rainbow.
                               Default: 30
                  spread     : Spread/width of each color.
                               Default: 3.0,
                  linemode   : Colorize each line in the input.
                               Default: True
                  movefactor : Factor for offset increase on each line when
                               using linemode.
                               Minimum value: 0
                               Default: 2
                  rgb_mode   : Use RGB escape codes instead of extended 256 and
                               approximate hex matches.