def reverse_lex_128(ustring):
 newstr = u''
 for ii in ustring:
  ordinance = ord(ii)
  new_byte = (127 - ordinance)
  char = unichr(new_byte)
  newstr += char
 return newstr

def reverse_lex_128 ( ustring ) : newstr = u'' for ii in ustring : ordinance = ord ( ii ) new_byte = ( 127 - ordinance ) char = unichr ( new_byte ) newstr += char return newstr
certain datastores are unable to store keys with unichars of 128 or more this function reflects on 127 and less .