def unpad_pkcs5(padded, block_size):
    """
    Returns the unpadded version of a data padded using PKCS5.

    :param padded: String padded with PKCS5.
    :type padded: :class:`str`

    :return: :class:`str` -- Original, unpadded string.
    """
    assert padded and len(padded) % block_size == 0
    pad_size = ord(padded[-1])
    assert 1 <= pad_size <= block_size
    pad = padded[-pad_size:]
    assert pad == pad[-1] * pad_size
    return padded[:-pad_size]
