#NEWLINE# def get_symbol( ) : #NEWLINE# #INDENT# ' Read a symbol, which can be a single byte character or a multibyte string' #NEWLINE# ch = read_char ( ) #NEWLINE# ch_code = ord ( ch ) #NEWLINE# if ( ch_code == keys . ESC ) : #NEWLINE# #INDENT# ch = read_char_no_blocking ( ) #NEWLINE# if ( ch == '' ) : #NEWLINE# #INDENT# return keys . ESC #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( ch != 'O' ) and ( ch != '[' ) ) : #NEWLINE# #INDENT# return ord ( ch ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ch = read_char_no_blocking ( ) #NEWLINE# if ( ch == 'A' ) : #NEWLINE# #INDENT# return keys . UP #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ch == 'B' ) : #NEWLINE# #INDENT# return keys . DOWN #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ch == 'C' ) : #NEWLINE# #INDENT# return keys . RIGHT #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ch == 'D' ) : #NEWLINE# #INDENT# return keys . LEFT #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ch == 'Z' ) : #NEWLINE# #INDENT# return keys . SHIFTTAB #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return ch_code