def __replace_repeat(_sentence):
    """
    Allows the use of repeating random-elements such as in the 'Ten green bottles' type sentences.

    :param _sentence:
    """
    _repeat_dict = {}
    if _sentence is not None:
        while _sentence.find('#DEFINE_REPEAT') != -1:
            _begin_index = _sentence.find('#DEFINE_REPEAT')
            _start_index = _begin_index + 15
            _end_index = _sentence.find(']')
            if _sentence.find('#DEFINE_REPEAT') is not None:
                _sub_list = _sentence[_start_index:_end_index].split(',')
                _choice = _sub_list[0]
                _repeat_text = _sub_list[1]
                _repeat_dict[_choice] = _repeat_text
                _sentence = _sentence.replace(_sentence[_begin_index:
                    _end_index + 1], '', 1)
        while _sentence.find('#REPEAT') != -1:
            if _sentence.find('#REPEAT') is not None:
                _repeat_begin_index = _sentence.find('#REPEAT')
                _repeat_start_index = _repeat_begin_index + 8
                _repeat_end_index = _sentence.find(']', _repeat_start_index)
                _repeat_index = _sentence[_repeat_start_index:_repeat_end_index
                    ]
                if _repeat_index in _repeat_dict:
                    _sentence = _sentence.replace(_sentence[
                        _repeat_begin_index:_repeat_end_index + 1], str(
                        _repeat_dict[_repeat_index]))
        if _sentence.find('#REPEAT') == -1:
            return _sentence
        return _sentence
    else:
        return _sentence
