'Similar to split, but always creates a tuple with three items:
1. The part before the separator
2. The separator itself.
3. The part after.
We use the same techniques we used in split() to make sure each are
colored.'

def partition(self, sep, reverse=False):

    if hasattr(sep, '_clean_string'):
        sep = sep.clean()
    if reverse:
        parent_result = self._clean_string.rpartition(sep)
    else:
        parent_result = self._clean_string.partition(sep)
    current_index = 0
    result = tuple()
    for section in parent_result:
        result += (self[current_index:(current_index + len(section))],)
        current_index += len(section)
    return result
