'Return `input_str` with PKCS#7 padding trimmed to match AES block length'

@staticmethod
def _remove_padding(input_str):

    num_pad_bytes = ord(input_str[(-1)])
    if ((num_pad_bytes < 1) or (num_pad_bytes > AES.block_size) or (num_pad_bytes >= len(input_str))):
        raise UsernameDecryptionException('padding')
    return input_str[:(- num_pad_bytes)]
