code: def swap_characters_before_cursor(self):
          
          pos = self.cursor_position
  
          if pos >= 2:
              a = self.text[pos - 2]
              b = self.text[pos - 1]
  
              self.text = self.text[:pos-2] + b + a + self.text[pos:]
docs: Swap the last two characters before the cursor.