Same as str.rpartition(), except that the partitioning is done case insensitive.

def _case_insensitive_rpartition(input_string: str, separator: str) -> typing.Tuple[str, str, str]:
        """Same as str.rpartition(), except that the partitioning is done case insensitive."""
        lowered_input_string = input_string.lower()
        lowered_separator = separator.lower()
        try:
            split_index = lowered_input_string.rindex(lowered_separator)
        except ValueError:
            # Did not find the separator in the input_string.
            # Follow https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str
            # str.rpartition documentation and return the tuple ("", "", unmodified_input) in this case
            return "", "", input_string
        else:
            split_index_2 = split_index+len(separator)
            return input_string[:split_index], input_string[split_index: split_index_2], input_string[split_index_2:]