def match_parentheses(dot, position):
    """Find matching parenthesis in bracket notation.

    Args:
        dot: Bracket notation.
        position: Position where there is an opening parenthesis to match.

    Returns:
        i: Index of matching parenthesis (-1 if nothing was found).
    """
    stack = 0
    for i in range(position + 1, len(dot)):
        if dot[i] == '(':
            stack += 1
        elif dot[i] == ')':
            if stack == 0:
                return i
            else:
                stack -= 1
    return -1