code: def transform_region(self, from_, to, transform_callback):
          
          assert from_ < to
  
          self.text = ''.join([
              self.text[:from_] +
              transform_callback(self.text[from_:to]) +
              self.text[to:]
          ])
docs: Transform a part of the input string.
  
          :param from_: (int) start position.
          :param to: (int) end position.
          :param transform_callback: Callable which accepts a string and returns
              the transformed string.