def matchclose(c_lineno, c_symbol, openers, pairmap):
 try:
  (o_lineno, o_symbol) = openers.pop()
 except IndexError:
  print ("\nDelimiter mismatch.  On line %d, encountered closing '%s' without corresponding open" % (c_lineno, c_symbol))
  return
 if (o_symbol in pairmap.get(c_symbol, [c_symbol])):
  return
 print ("\nOpener '%s' on line %d was not closed before encountering '%s' on line %d" % (o_symbol, o_lineno, c_symbol, c_lineno))
 return

def matchclose ( c_lineno , c_symbol , openers , pairmap ) : try : ( o_lineno , o_symbol ) = openers . pop ( ) except IndexError : print ( "\nDelimiter mismatch.  On line %d, encountered closing '%s' without corresponding open" % ( c_lineno , c_symbol ) ) return if ( o_symbol in pairmap . get ( c_symbol , [ c_symbol ] ) ) : return print ( "\nOpener '%s' on line %d was not closed before encountering '%s' on line %d" % ( o_symbol , o_lineno , c_symbol , c_lineno ) ) return
verify that closing delimiter matches most recent opening delimiter .