code: def removeZeroLenPadding(str, blocksize=AES_blocksize):
    'Remove Padding with zeroes + last byte equal to the number of padding bytes'
    try:
      pad_len = ord(str[-1]) # last byte contains number of padding bytes
    except TypeError:
      pad_len = str[-1]
    assert pad_len < blocksize, 'padding error' 
    assert pad_len < len(str), 'padding error'
      
    return str[:-pad_lenf removeZeroLenPadding(str, blocksize=AES_blocksize):
    'Remove Padding with zeroes + last byte equal to the number of padding bytes'
    try:
      pad_len = ord(str[-1]) # last byte contains number of padding bytes
    except TypeError:
      pad_len = str[-1]
    assert pad_len < blocksize, 'padding error' 
    assert pad_len < len(str), 'padding error'
      
    return str[:-pad_len]
docs: Remove Padding with zeroes + last byte equal to the number of padding bytes