def _find_nested_pair(string, open_ch, close_ch, start):
    """Finds a pair of tag characters. This handles nested tags in a form:
        [tag1[tag2]]

    In above example, when searched from the first character, this function
    returns first and last position, not first and second to last."""
    pos_start = None
    opened = []
    found = []
    min_found = len(string) + 1, len(string) + 1
    for pos, ch in enumerate(string[start:], start=start):
        if ch == open_ch:
            opened.append(pos)
        if ch == close_ch:
            if opened:
                found.append((opened.pop(), pos))
                if len(opened) == 0:
                    return found[-1]
                else:
                    min_found = min(min_found, found[-1])
    if found:
        return min_found
    return -1, -1
