#NEWLINE# def rot_n( string , n ) : #NEWLINE# #INDENT# 'Modified, based on: http://en.literateprograms.org/Rot13_(Python)' #NEWLINE# if ( not isinstance ( _handle_char , int ) ) : #NEWLINE# #INDENT# raise TypeError #NEWLINE# #UNINDENT# def _handle_char( char ) : #NEWLINE# #INDENT# if ( not char . isalpha ( ) ) : #NEWLINE# #INDENT# return char #NEWLINE# #UNINDENT# dist = ( n if ( char . lower ( ) <= 'm' ) else ( - n ) ) #NEWLINE# return chr ( ( ord ( char ) + dist ) ) #NEWLINE# #UNINDENT# return '' . join ( [ _handle_char ( char ) for char in list ( string ) ] )