def ReverseCloseExpression(clean_lines, linenum, pos):
 line = clean_lines.elided[linenum]
 endchar = line[pos]
 if (endchar not in ')}]>'):
  return (line, 0, (-1))
 if (endchar == ')'):
  startchar = '('
 if (endchar == ']'):
  startchar = '['
 if (endchar == '}'):
  startchar = '{'
 if (endchar == '>'):
  startchar = '<'
 (start_pos, num_open) = FindStartOfExpressionInLine(line, pos, 0, startchar, endchar)
 if (start_pos > (-1)):
  return (line, linenum, start_pos)
 while (linenum > 0):
  linenum -= 1
  line = clean_lines.elided[linenum]
  (start_pos, num_open) = FindStartOfExpressionInLine(line, (len(line) - 1), num_open, startchar, endchar)
  if (start_pos > (-1)):
   return (line, linenum, start_pos)
 return (line, 0, (-1))

def ReverseCloseExpression ( clean_lines , linenum , pos ) : line = clean_lines . elided [ linenum ] endchar = line [ pos ] if ( endchar not in ')}]>' ) : return ( line , 0 , ( - 1 ) ) if ( endchar == ')' ) : startchar = '(' if ( endchar == ']' ) : startchar = '[' if ( endchar == '}' ) : startchar = '{' if ( endchar == '>' ) : startchar = '<' ( start_pos , num_open ) = FindStartOfExpressionInLine ( line , pos , 0 , startchar , endchar ) if ( start_pos > ( - 1 ) ) : return ( line , linenum , start_pos ) while ( linenum > 0 ) : linenum -= 1 line = clean_lines . elided [ linenum ] ( start_pos , num_open ) = FindStartOfExpressionInLine ( line , ( len ( line ) - 1 ) , num_open , startchar , endchar ) if ( start_pos > ( - 1 ) ) : return ( line , linenum , start_pos ) return ( line , 0 , ( - 1 ) )
if input points to ) or } or ] or > .