def _unpad_message(text):
 if (not text):
  return ''
 padding_size = ord(text[(-1)])
 if (padding_size > AES.block_size):
  return ''
 (unpadded, padding) = (text[:(- padding_size)], text[(- padding_size):])
 if any(((ord(x) != padding_size) for x in padding)):
  return ''
 return unpadded

def _unpad_message ( text ) : if ( not text ) : return '' padding_size = ord ( text [ ( - 1 ) ] ) if ( padding_size > AES . block_size ) : return '' ( unpadded , padding ) = ( text [ : ( - padding_size ) ] , text [ ( - padding_size ) : ] ) if any ( ( ( ord ( x ) != padding_size ) for x in padding ) ) : return '' return unpadded
return text with padding removed .