def parse_balanced_delimiters(_input, _d_left, _d_right, _text_qualifier):
    """Removes all balanced delimiters. Handles multiple levels and ignores those contained within text delimiters."""
    _depth = 0
    _balanced = []
    _cleared = ''
    _text_mode = False
    _start_pos = None
    _clear_start_pos = 0
    for _curr_idx in range(len(_input)):
        _curr_char = _input[_curr_idx]
        if _curr_char == _text_qualifier:
            _text_mode = not _text_mode
        elif not _text_mode:
            if _curr_char == _d_left:
                if _depth == 0:
                    _start_pos = _curr_idx
                    _cleared += _input[_clear_start_pos:_curr_idx]
                    _clear_start_pos = None
                _depth += 1
            elif _curr_char == _d_right:
                _depth -= 1
            if _start_pos and _depth == 0 and _start_pos < _curr_idx:
                _balanced.append(_input[_start_pos + 1:_curr_idx])
                _start_pos = None
                _clear_start_pos = _curr_idx + 1
    if _cleared == '':
        return _balanced, _input
    else:
        return _balanced, _cleared
