Partition the input into text before, typed abbreviation (if it exists), and text after

def _partition_input(self, current_string: str, abbr: typing.Optional[str]) -> typing.Tuple[str, str, str]:
        """
        Partition the input into text before, typed abbreviation (if it exists), and text after
        """
        if abbr:
            if self.ignoreCase:
                string_before, typed_abbreviation, string_after = self._case_insensitive_rpartition(
                    current_string, abbr
                )
                abbr_start_index = len(string_before)
                abbr_end_index = abbr_start_index + len(typed_abbreviation)
                typed_abbreviation = current_string[abbr_start_index:abbr_end_index]
            else:
                string_before, typed_abbreviation, string_after = current_string.rpartition(abbr)

            return string_before, typed_abbreviation, string_after
        else:
            # abbr is None. This happens if the phrase was typed/pasted using a hotkey and is about to be un-done.
            # In this case, there is no trigger character (thus empty before and after text). The complete string
            # should be undone.
            return "", current_string, ""