#NEWLINE# def get_code( country , state ) : #NEWLINE# #INDENT# cindex = bisect . bisect_left ( COUNTRIES , country ) #NEWLINE# if ( ( cindex > len ( COUNTRIES ) ) or ( COUNTRIES [ cindex ] != country ) ) : #NEWLINE# #INDENT# cindex = ( - 1 ) #NEWLINE# #UNINDENT# cindex += 1 #NEWLINE# sindex = ( - 1 ) #NEWLINE# if ( state and ( country in STATES ) ) : #NEWLINE# #INDENT# states = STATES [ country ] #NEWLINE# sindex = bisect . bisect_left ( states , cindex ) #NEWLINE# if ( ( sindex > len ( states ) ) or ( states [ sindex ] != state ) ) : #NEWLINE# #INDENT# sindex = ( - 1 ) #NEWLINE# #UNINDENT# #UNINDENT# sindex += 1 #NEWLINE# return ( chr ( cindex ) + chr ( sindex ) )