def CloseExpression(clean_lines, linenum, pos):
 line = clean_lines.elided[linenum]
 if ((line[pos] not in '({[<') or Match('<[<=]', line[pos:])):
  return (line, clean_lines.NumLines(), (-1))
 (end_pos, stack) = FindEndOfExpressionInLine(line, pos, [])
 if (end_pos > (-1)):
  return (line, linenum, end_pos)
 while (stack and (linenum < (clean_lines.NumLines() - 1))):
  linenum += 1
  line = clean_lines.elided[linenum]
  (end_pos, stack) = FindEndOfExpressionInLine(line, 0, stack)
  if (end_pos > (-1)):
   return (line, linenum, end_pos)
 return (line, clean_lines.NumLines(), (-1))

def CloseExpression ( clean_lines , linenum , pos ) : line = clean_lines . elided [ linenum ] if ( ( line [ pos ] not in '({[<' ) or Match ( '<[<=]' , line [ pos : ] ) ) : return ( line , clean_lines . NumLines ( ) , ( - 1 ) ) ( end_pos , stack ) = FindEndOfExpressionInLine ( line , pos , [ ] ) if ( end_pos > ( - 1 ) ) : return ( line , linenum , end_pos ) while ( stack and ( linenum < ( clean_lines . NumLines ( ) - 1 ) ) ) : linenum += 1 line = clean_lines . elided [ linenum ] ( end_pos , stack ) = FindEndOfExpressionInLine ( line , 0 , stack ) if ( end_pos > ( - 1 ) ) : return ( line , linenum , end_pos ) return ( line , clean_lines . NumLines ( ) , ( - 1 ) )
if input points to ( or { or [ or < .