def vi_pos_matching(line, index=0):
 anchor = None
 target = None
 delta = 1
 count = 0
 try:
  while 1:
   if (anchor is None):
    try:
     (target, delta) = _vi_dct_matching[line[index]]
     anchor = line[index]
     count = 1
    except KeyError:
     index += 1
     continue
   else:
    if (index < 0):
     return (-1)
    if (line[index] == anchor):
     count += 1
    elif (line[index] == target):
     count -= 1
     if (count == 0):
      return index
   index += delta
 except IndexError:
  return (-1)

def vi_pos_matching ( line , index = 0 ) : anchor = None target = None delta = 1 count = 0 try : while 1 : if ( anchor is None ) : try : ( target , delta ) = _vi_dct_matching [ line [ index ] ] anchor = line [ index ] count = 1 except KeyError : index += 1 continue else : if ( index < 0 ) : return ( - 1 ) if ( line [ index ] == anchor ) : count += 1 elif ( line [ index ] == target ) : count -= 1 if ( count == 0 ) : return index index += delta except IndexError : return ( - 1 )
find matching <> .