code: def transform_lines(self, line_index_iterator, transform_callback):
          
          # Split lines
          lines = self.text.split('\n')
  
          # Apply transformation
          for index in line_index_iterator:
              try:
                  lines[index] = transform_callback(lines[index])
              except IndexError:
                  pass
  
          return '\n'.join(lines)
docs: Transforms the text on a range of lines.
          When the iterator yield an index not in the range of lines that the
          document contains, it skips them silently.
  
          To uppercase some lines::
  
              new_text = transform_lines(range(5,10), lambda text: text.upper())
  
          :param line_index_iterator: Iterator of line numbers (int)
          :param transform_callback: callable that takes the original text of a
                                     line, and return the new text for this line.
  
          :returns: The new text.