def findEndBrace(s, lbchar='(', rbchar=')'):
    """Find position in string (or list of strings), s, at which final matching
    brace occurs (if at all). If not found, returns None.

    s[0] must be the left brace character. Default left and right braces are
    '(' and ')'. Change them with the optional second and third arguments.
    """
    pos = 0
    assert s[0] == lbchar, 'string argument must begin with left brace'
    stemp = s
    leftbrace_count = 0
    notDone = True
    while len(stemp) > 0 and notDone:
        # for compatibility with s being a list, use index method
        try:
            left_pos = stemp.index(lbchar)
        except ValueError:
            left_pos = -1
        try:
            right_pos = stemp.index(rbchar)
        except ValueError:
            right_pos = -1
        if left_pos >= 0:
            if left_pos < right_pos:
                if left_pos >= 0:
                    leftbrace_count += 1
                    pos += left_pos+1
                    stemp = s[pos:]
                else:
                    # no left braces found. next brace is right.
                    if leftbrace_count > 0:
                        leftbrace_count -= 1
                        pos += right_pos+1
                        stemp = s[pos:]
            else:
                # right brace found first
                leftbrace_count -= 1
                pos += right_pos+1
                stemp = s[pos:]
        else:
            if right_pos >= 0:
                # right brace found first
                leftbrace_count -= 1
                pos += right_pos+1
                stemp = s[pos:]
            else:
                # neither were found (both == -1)
                raise ValueError('End of string found before closing brace')
        if leftbrace_count == 0:
            notDone = False
            # adjust for
            pos -= 1
    if leftbrace_count == 0:
        return pos
    else:
        return None