def safe_split(text, split_chars=' ',
               start_protected_chars='[', end_protected_chars=']'):
    """Safely split text even in split_chars are inside protected regions.

    Protected regions starts with any character from the start_protected_chars
    argument and ends with any character from the end_protected_chars argument.

    If a char from split_chars is found inside a protected region it will be
    ignored and the text will not be splited at that position.
    """
    parts = []
    inside_protected_region = False
    last_part = []
    for char in text:
        if char in start_protected_chars:
            inside_protected_region = True

        if char in end_protected_chars:
            inside_protected_region = False

        if char in split_chars:
            if inside_protected_region:
                last_part.append(char)
            else:
                parts.append(u''.join(last_part))
                last_part = []

        else:
            last_part.append(char)

    if last_part:
        parts.append(u''.join(last_part))

    return parts